getting to the doc object inside a frameset/frame

140 views
Skip to first unread message

dashman

unread,
Feb 3, 2010, 7:48:03 AM2/3/10
to Chromium-extensions
i'm writing a content script.

the page has a frameset and a frame inside it

i'm trying to access the document object inside the frame.

help!


i've got the following

if ( self != top )
return;

if ( window.frames.length == 1 )
{
var doc = window.frames[0].document;

// doc is undefined????
}

Daniel Wagner-Hall

unread,
Feb 3, 2010, 10:48:37 AM2/3/10
to dashman, Chromium-extensions

Ronald Schouten

unread,
Feb 3, 2010, 6:16:13 PM2/3/10
to Chromium-extensions
Assuming all the frames are on the same domain, I think you need to use contentDocument instead document on the frame element. So your code would look like this:

window.frames[0].contentDocument

Ron



--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.




--
Ronald Schouten - Web Developer / JavaScript Ninja

Like Google Chrome and Gmail? Try my Gmail Notes extension.
https://chrome.google.com/extensions/detail/hiheeapdnogdfdcbpjpibpllaifndgke
Reply all
Reply to author
Forward
0 new messages