Answer the question
In order to leave comments, you need to log in
Is it possible to change the content of an Iframe from within a Chrome extension?
I'm writing a Chrome extension and I need to modernize the content of an Iframe on a page.
Paste the code through executeScript and there it is impossible to access the frame: it gives a security error.
Is there any way to change the contents of an IFrame directly from an extension? (For example, as with ajax requests: you cannot insert a script into a page and from there send a request to another domain - a security error, but it is possible to send requests from the extension itself).
Answer the question
In order to leave comments, you need to log in
You need a content script that is loaded on the URL that is loaded in the frame.
This script will have access to the content.
There can be several content scripts in one extension.
"content_scripts": [
{ "matches: "http://урл_по_которому_грузится_фрейм",
"js": "скрипт_коорый_грузить_в_этот_фрейм" }
]
manifest.permissions for the extension must match the frame url.
no other way.
there, however, you can shove patterns.
Get an iframe extension. Modify and paste on the page. It's better to parse with an iframe extension if you have large modifications.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question