/    Sign up×
Community /Pin to ProfileBookmark

accessing links within an iframe

Hi,

I have an html document which:

A) contains an iframe: “iframe1”
? opens a pop-up window: “popup1”

How can I access the iframe’s link object from the popup window.

I’ve tried everything. The closest I’ve come to it is placing the code below in the popup1 window:

[CODE]
var iframelinks = opener.document.getElementById(‘iframe1’);
var iframelinks2 = iframelinks.document.links[0].href;
document.write(iframelinks2);
[/CODE]

Using my amateur logic, iframelinks2 should be referencing a link within the iframe, but instead it references a link in the main parent window.

any help is appreciated. thanks.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@KorDec 14.2005 — var iframelinks = [COLOR=Blue]opener[/COLOR].[COLOR=Green][COLOR=DarkRed]document.getElementById('iframe1').contentWindow[/COLOR].document.getElementsByTagName('a')[0][/COLOR].getAttribute('href');
Copy linkTweet thisAlerts:
@medc77authorDec 14.2005 — perfect!!!!!

thanks!!!!!!!!!!! ?
×

Success!

Help @medc77 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...