Hi Jonna, Unfortunately that doesn't work for Chrome, that might be a bug unless it is intended. Maybe someone someone from the extensions team verify if thats intended or not?
A reduction is: popup.html > <iframe src ="http://www.google.ca" width="100%" height="300"> <p>Your browser does not support iframes.</p> </iframe> contentscript.html > alert('Hello World!'); It seems iframes in popups doesn't execute anything from the content script even if we place "all_frames" to true in the manifest. -Mohamed Mansour On Mon, Dec 28, 2009 at 1:21 PM, jonna <[email protected]> wrote: > Hi Mansour, > > Thanks for the reply. When I mean attaching, I want to inject my own > content script in to the iframe being loaded in the Popup. i.e. for > example, I will open google.com in an iframe in popup.html. I want to > inject a content script into that iframe content(google's page). This > was possible in the old Toolstrip/Mole architecture. I had an iframe > in the mole and was able to inject content scripts into that iframe > webpage. Now it is not possible. > > Thanks, > Jonna. > > On Dec 28, 11:04 am, Mohamed Mansour <[email protected]> wrote: > > Hi Jonna, > > > > When you mean "attaching", do you want popup.html to have access to the > > content script? If so, you can use message communication between the > Popup > > and the Content script of the current tab. > > > > For example, in your popup.html you can do something like this: > > > > > chrome.tabs.getSelected(null, function(tab) { > > > > // Send a request to the content script. > > > > chrome.tabs.sendRequest(tab.id, {action: "giveMeSomething"}, > > > > > function(response) { > > > > console.log(response.result); > > > > }); > > > > }); > > > > While your content script should listen: > > > > > chrome.extension.onRequest.addListener(function(request, sender, > > > sendResponse) { > > > > if (request.action == "giveMeSomething") > > > > sendResponse({result: "Some result from content script"}); > > > > else > > > > sendResponse({}); // Send nothing.. > > > > }); > > > > I explained this for someone in stackedoverflow, > http://stackoverflow.com/questions/1964225/accessing-current-tab-dom-... > > > > That is one of the ways to actually let your popup script to read > anything > > from the content script, that is called a simple one time request. > Another > > way which is a long living connection between your extension and the > content > > script is to use chrome.extension.connect(), for more information > regarding > > Message Passing, refer to this document: > http://code.google.com/chrome/extensions/messaging.html > > > > -Mohamed Mansour > > > > > > > > On Mon, Dec 28, 2009 at 2:30 AM, jonna <[email protected]> wrote: > > > Hi, > > > > > The content scripts are not attaching to popup.html or any other > > > iframes inside popup.html in BrowserActions. The previous architecture > > > of Toolstrips/Moles attached any content scripts to the iframes inside > > > the mole. It would be great if this feature is included in the iframes > > > in popup.html even in BrowserActions. Can anyone give me an update if > > > this feature would "ever" be included as this feature greatly affects > > > the extension we are developing. > > > > > Thanks, > > > Jonna. > > > > > -- > > > > > You received this message because you are subscribed to the Google > Groups > > > "Chromium-extensions" group. > > > To post to this group, send email to > [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]<chromium-extensions%[email protected]><chromium-extensions%2Bunsu > [email protected]> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/chromium-extensions?hl=en. > > -- > > You received this message because you are subscribed to the Google Groups > "Chromium-extensions" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<chromium-extensions%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/chromium-extensions?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Chromium-extensions" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/chromium-extensions?hl=en.
