禁止右键功能,且禁止选择

<body oncontextmenu=self.event.returnValue=false onselectstart="return false">

 

将html转换成canvas图片(详细请参考:https://github.com/niklasvh/html2canvas)

1、直接引入html2canvas.js

2、生成canvas图片

<script src="{:config('theme_path')}/index/js/tools/html2canvas.min.js"></script> 
<script type="text/javascript">
setTimeout(function(){
html2canvas(document.getElementById('lawCaseImg'), {
onrendered: function(canvas) {
var url = canvas.toDataURL(); //图片地址
var lawList = document.getElementsByClassName('law-case-details-box')[0];
var caseDetail = document.getElementById('lawCaseImg');
$('#lawCaseImg').after(canvas);
$('body').attr('oncontextmenu','self.event.returnValue=false');
caseDetail.innerHTML='';
},
letterRendering: true
});

},3000);
</script>