具体代码如下所示:
html2canvas_downloada {
cursor: pointer;
color: rgb(85, 26, 139);
text-decoration: underline;
}
hello world!
var oDiv = document.getElementById('oDiv');
// body截图
// html2canvas(document.body).then(function(canvas) {
// document.body.appendChild(canvas);
// });
html2canvas(oDiv).then(function(canvas) {
document.body.appendChild(canvas);
var oCavans = document.getElementsByTagName('canvas')[0];
var strDataURI = oCavans.toDataURL();
downLoadFn(strDataURI);
});
//判断浏览器类型
function myBrowser() {
var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
var isOpera = userAgent.indexOf("Opera