开发者

Firefox question: Is it possible to create an html iframe which loads a document from my extension using the chrome://?

开发者 https://www.devze.com 2023-03-18 07:19 出处:网络
I was wondering if it is possible to create an iframe whithin a HTML document pointing to a XUL document whithin my firefox extension such like:

I was wondering if it is possible to create an iframe whithin a HTML document pointing to a XUL document whithin my firefox extension such like:

<iframe src="chrome://myextension/content/document.xul"/>

I am currently getting security errors when trying to do this. I've already tried the contentaccessible=yes flag in my chrome.manifest but it didn't w开发者_开发问答ork.

Is there any workaround to get this working?

Thanks.


No, web pages are generally not allowed to load chrome documents. contentaccessible=yes refers to images and scripts that are less regulated security-wise (they can also be used across domains). However, your extension has permission to load chrome documents - even into a content page. So doing something like this from your extension will work:

window.content.frames[0].location.href = "chrome://myextension/content/document.xul";

Not sure whether this will help you, depends on what you are trying to achieve.

0

精彩评论

暂无评论...
验证码 换一张
取 消