用about:config覆盖Firefox不安全的警告 [英] Override Firefox Insecure Warnings with about:config

查看:249
本文介绍了用about:config覆盖Firefox不安全的警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编写一个简单的批处理脚本来截取我内部网页的截图,并且发现firefox有这个能够将窗口渲染到canvas的事实:

  var canvas = document.createElement('canvas'); 
var ctx = canvas.getContext(2d);
ctx.drawWindow(window,0,0,100,200,rgb(255,255,255));
console.log(canvas.toDataURL(image / png));

但是,这似乎只保留了表单扩展名并引发错误:操作是不安全的。 / p>

我不需要把这个发布给任何其他人,我很乐意仅对我的Firefox进行一些内部调整,以避免创建扩展。是否有一些关于:配置设置(或其他)我可以调整,只要让它通过,即使它不是在扩展?

解决方案

转到 about:config 并将 devtools.chrome.enabled 设置为 true

重新启动

转到您想要截取的选项卡

Shift +
将环境切换到浏览器

粘贴以下代码片段

  var canvas = gBrowser.contentDocument.createElement('canvas'); 
var ctx = canvas.getContext(2d);
ctx.drawWindow(window,0,0,100,200,rgb(255,255,255));
canvas.toDataURL(image / png);将光标放在最后一行的末尾

键,控制 + L

完成任务!


I am trying to write a simple batch script to take some screenshots of internal webpages on my end and came across the fact that firefox has this ability to render the window to canvas:

var canvas = document.createElement('canvas');
var ctx = canvas.getContext("2d");
ctx.drawWindow(window, 0,0, 100, 200, "rgb(255,255,255)");
console.log(canvas.toDataURL("image/png"));

However, this seems to be reserved only form extensions and throws an Error: The operation is insecure.

I don't need to publish this to anyone else and I'm happy to make some internal adjustment to only my Firefox to avoid creating an extension. Is there some sort of about:config setting (or something else) I can tweak to just let this go through even if it's not in an extension?

解决方案

Go to about:config and set devtools.chrome.enabled to true
Restart
Go to the tab you want to take screenshot
Press Shift+F4
Switch environment to Browser
Paste the following snippet

var canvas = gBrowser.contentDocument.createElement('canvas');
var ctx = canvas.getContext("2d");
ctx.drawWindow(window, 0,0, 100, 200, "rgb(255,255,255)");
canvas.toDataURL("image/png");

Place the cursor at the end of the last line
Press Control+L
Mission accomplished!

这篇关于用about:config覆盖Firefox不安全的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆