Accessing cross-domain iframes with content script

Kevin Jones kevinhowjones at gmail.com
Tue Oct 17 13:49:01 UTC 2017


Thanks Wildsky,

Yes, I am aware of cross-domain restrictions; what I am referring to is the
implication in the content scripts docs indicating permission can be
granted for overriding cross-domain restrictions.

On Tue, Oct 17, 2017 at 6:02 AM, Wildsky Fann <wildsky at moztw.org> wrote:

> Hi Kevin,
>
> In my opinion, the reason you can't find the answer is because you can't
> do that because of security concern.
>
> here is what you might want to read: https://stackoverflow.
> com/questions/6170925/get-dom-content-of-cross-domain-iframe.
>
> Maybe you could think about another solution from reading this document:
> https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/
> content_scripts ,the key all_frames might allow you to do you what you
> want.
>
> Good luck,
> Wildsky Fann
>
> 2017年10月17日 09:46,"Kevin Jones" <kevinhowjones at gmail.com>寫道:
>
>> Hello,
>>
>> Reading the following doc:
>>
>> https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Co
>> ntent_scripts#Cross-domain_privileges
>>
>> I get the impression that, using a content script, I should be able to
>> get access to the document in a web page's iframe, even if the src for the
>> iframe is in another domain, as long as I have provided sufficient
>> permissions.
>>
>> I have a situation where I am trying to do just that, but am
>> unsuccessful, with iframe.contentDocument == null.  I can read other
>> iframe's documents where the src is in the same domain.
>>
>> I have:
>>
>> "permissions": [ "<all_urls>"],
>>
>> set in my manifest.
>>
>> Am I not interpreting the doc correctly on this?
>>
>> ps, sorry for the repeat question (about 2 weeks ago) but I haven't been
>> able to find any help on this.
>>
>> Thanks,
>> Kevin
>>
>> _______________________________________________
>> Dev-addons mailing list
>> Dev-addons at mozilla.org
>> https://mail.mozilla.org/listinfo/dev-addons
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/dev-addons/attachments/20171017/99c64193/attachment.html>


More information about the Dev-addons mailing list