标签: csscritic

为什么我收到阻止的脚本执行错误?

我正在使用http://cburgmer.github.io/rasterizeHTML.js/将html变成画布.当我将代码更改为:

var canvas = document.getElementById("save_image_canvas");
// rasterizeHTML.drawHTML('<div style="font-size: 20px;">Some <span style="color: green">HTML</span> with an image</div>', canvas);
rasterizeHTML.drawHTML(document.getElementById("mattes").innerHTML, canvas);
Run Code Online (Sandbox Code Playgroud)

我在控制台中收到以下错误:

在'Mysite/Custom_App /'中阻止执行脚本,因为文档的框架是沙箱,并且未设置'allow-scripts'权限.

所有脚本和内容都位于同一台服务器上.

这是完整的功能:

function common_screenshot()
{
  var canvas = document.getElementById("save_image_canvas");
  if (typeof(moulding_canvas) === "undefined")
  {
    canvas.height = parseInt($("#matte_canvas").height());
    canvas.width = parseInt($("#matte_canvas").width());
  }
  else
  {
    canvas.height = parseInt($("#moulding_canvas").height());
    canvas.width = parseInt($("#moulding_canvas").width());
  }
  canvas.style.backgroundColor = "#FFFFFF";

  var moulding_top = -1 * parseInt(document.getElementById("moulding_canvas").style.top);
  var moulding_left = -1 * parseInt(document.getElementById("moulding_canvas").style.left);

  console.log("top: " + moulding_top);
  rasterizeHTML.drawHTML(document.getElementById("mattes").innerHTML).then(function (renderResult) 
  {
    context.drawImage(renderResult.image, moulding_left, moulding_top);
  });
  var …
Run Code Online (Sandbox Code Playgroud)

javascript csscritic

7
推荐指数
1
解决办法
3万
查看次数

标签 统计

csscritic ×1

javascript ×1