“错误:缺少标签的主机权限”在视图源:网址 [英] "Error: Missing host permission for the tab" on view-source: URLs

查看:317
本文介绍了“错误:缺少标签的主机权限”在视图源:网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的扩展程序重写为适用于Firefox和Google Chrome的WebExtensions,并且适用于HTTP / HTTPS。但是,它不再适用于使用 view-source:方案的URL。 (这些URL是CTRL + U显示的网页的HTML源代码。)

Firefox 57出现此错误


错误:缺少标签的主机权限

Google Chrome 62显然没有任何功能。



没有关于视图源方案的文档。有没有办法启用扩展的视图源?

解决方案

我没有涉足过多的扩展,但自从错误涉及到Firefox中的主机权限,请查看主机权限
$ b


在Firefox中,从版本56开始,扩展会自动获得主机
的权限,的形式:

  moz-extension:// 60a20a9b-1ad4-af49-9b6c-c64c98c37920 / 
其中60a20a9b -1ad4-af49-9b6c-c64c98c37920是扩展的内部标识。该扩展可以以编程方式通过

调用extension.getURL():

  browser.extension.getURL(); 
// moz-extension:// 60a20a9b-1ad4-af49-9b6c-c64c98c37920 /



I rewrote my extension to WebExtensions for Firefox and Google Chrome, and it works fine for HTTP/HTTPS. However, it no longer works on URLs with the view-source: scheme. (These URLs are the HTML source code of web pages shown by CTRL+U.)

Firefox 57 gives this error

Error: Missing host permission for the tab

Google Chrome 62 does apparently nothing.

There is no documentation about the view-source scheme. Is there a way to enable the extension for view-source?

解决方案

I haven't dabbled too much in extensions but since the error involves Host permissions in firefox, check the Host permissions:

In Firefox, from version 56 onwards, extensions automatically get host permissions for their own origin, which is of the form:

moz-extension://60a20a9b-1ad4-af49-9b6c-c64c98c37920/
where 60a20a9b-1ad4-af49-9b6c-c64c98c37920 is the extension's internal ID. The extension can get this URL programmatically by

calling extension.getURL():

browser.extension.getURL("");
// moz-extension://60a20a9b-1ad4-af49-9b6c-c64c98c37920/

这篇关于“错误:缺少标签的主机权限”在视图源:网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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