Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Let me see if I understand the question.</p> <p>You would need to add to your content script manifest the permission to access that page that has the iframe. Once you do, you use <a href="http://code.google.com/chrome/extensions/content_scripts.html" rel="nofollow">Content Scripts</a> and its <a href="http://code.google.com/chrome/extensions/messaging.html" rel="nofollow">Message Passing</a> to pass data to that iframe.</p> <p>In the example above, you would need to inject a content script, so in your manifest:</p> <pre><code>"content_scripts": [{ "matches": ["https://www.my.injected.url/*"], "js": ["injected_script_that_has_the_iframe.js"], "run_at": "document_end", "all_frames": true }] </code></pre> <p>Then in that content script, you can do normal JavaScript to set the URL:</p> <pre><code>document.getElementById("link").src= someURL; </code></pre> <p>Now, where is that URL coming from? Is it coming from your extension? If so, use Message Passing to request that.</p> <pre><code>chrome.extension.sendRequest({method: "GetURL"}, function(response) { document.getElementById("link").src= response.url; }); </code></pre> <p>And within your background page, you listen for requests coming from your background page:</p> <pre><code>chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { if (request.method == "GetURL") sendResponse({url: "http://rim.com"}); else sendResponse({}); // snub them. }); </code></pre> <p>To recap, your content script asks your extension (background page), what the URL is, and once it gets a response, it updates the iframe.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload