I have a Chrome extension that contains a page, chrome-extension://foo/index.html
That page contains an iframe, which loads pages I do not own (not on the same domain).
I want to inject a script into that iframe from the Chrome extension - however, URLs starting with chrome-extension:// are not a valid match pattern for either the "permissions" or "content_scripts" field of the manifest (so I cannot inject it programmatically or declaratively). I am able to inject the script if I host my index.html file elsewhere (not as part of the Chrome extension), but it's annoying to have to have part of my Chrome extension hosted elsewhere. Is there any way to give my extension permissions to inject a script in an iframe inside a file that it owns?
Related
I'm working on Chrome extension, that need to work with another extension (Metamask).
Standard way of doing this is by window.ethereum object, but from content script this object is undefined.
I found Can the window object be modified from a Chrome extension? but all examples are blocked by CSP of website (in my case twitter.com)
Is there any way of bypassing CSP from chrome extension's context?
I want to show the contents of the frame.html file in my extension folder in an iframe on the standalone page where I'm running the extension. But it is looking for this frame.html file in the source of the site and cannot find it so I'm getting a 404 not found error. Regardless of the relevant page, how can I access the frame.html file embedded in the extension file?
Let me show you in the picture what i want;
What I want
On the left is an ordinary web page on which the extension will be activated. Red area is my iframe that activated on the web site due to my extension. This area contents is in the frame.html at extension folder.
when I use <iframe src="extension_src/html/frame.html"></iframe>
I get a "www.......com/extension_src/html/frame.html" not found error
You can point the src to your local file using the template shown below.
<iframe src="chrome-extension://{{id-of-your-extension}}/path-to-file/frame.html"></iframe>
You extension id will be constant when published to the chrome store. When developing locally you can find the extension id by going to the chrome://extensions
I am creating an extension and wondering if it is possible to use a content script to modify an html page that is part of the chrome extension?
The background script creates a new tab and displays the included html page. I wanted to modify the content of that html page based on settings in the extension options page.
I have a chrome extension where the popup.html simply has an iframe that loads a page.
I want to allow users to select their language, and as I'm helping a charity do this each language page is very different as they need very different content based on the country!
Therefore, I can't just replace some of the fields like the google developer page example does; I need to change the page that is loaded in the iframe.
e.g. In my directory where the pages are stored I have english.html, german.html, spanish.html all of which are completely different pages.
By default the english.html page loads in the iframe, but the user should be able to go into the options file and select german so when they click on the extension the german.html loads by default every time.
Here is the jsfiddle showing what I currently have in the popup.html, and the popup.js:
http://jsfiddle.net/hemang2/EDV82/
You'll see the flickr API being called, but that's only there because I wasn't sure how to get rid of it!
So essentially my question is how to link the options file to change the default url loaded in the iframe.
Use the setPopup method: http://developer.chrome.com/extensions/browserAction.html#method-setPopup
It allows you to set any html file as your popup.
I have an iframe within the main window named "test_iframe". I want to access the content of "test_iframe" within a Google Chrome extension. I understand that I can do this if I have requisite permissions given in manifest.json.
Can I access the content of this iframe from a background HTML page? Or can I access it in a content script which is part of that extension? (In the latter case I suppose I have to pass the iframe content from the content script to a background page as part of a message for further processing(?))
Let's say this test_iframe comes from http://frame.example.com. I would just inject a content script directly to frame.example.com (instead of the parent page) and do everything there.