/    Sign up×
Community /Pin to ProfileBookmark

.SRC retrieves old URL

I am writing javascript in a page with an IFRAME that references an HTML file with thumbnail images created by a JAlbum (photo album processing software) skin. The HTML file replaces itself with the next set of images (another HTML file) if you click on its NEXT arrow. The issue is that I need to get the filename of the CURRENT HTML file, not the original HTML file. When I use <iframe onload=”functionname(this)”>, it seems to pass the original HTML source object, not the current one. So within functionname if I try alert(parameter1.src), I get the original filename, not the new one.

Here’s the IFRAME Code:

[CODE]<iframe src=”../../photos/index.htm” name=”galleryFrame” align=”left” frameborder=”0″ height=”100″ width=”800″ scrolling=”no” onload=”getThumbNames(this);”></iframe>[/CODE]

and here’s the relevant portion of the function it activates:

[CODE]function getThumbNames(frameOb) {
indexURL = frameOb.src;
alert(indexURL);
}[/CODE]

Any ideas?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@KorMar 20.2007 — That is normal, as you do not change the attribute src. You must check the location of the window loaded in the iframe

<i>
</i>function getThumbNames(frameOb) {
indexURL = frameOb.[COLOR="Blue"]contentWindow.location.href[/COLOR];
alert(indexURL);
}
Copy linkTweet thisAlerts:
@mousebearauthorMar 20.2007 — Much obliged. That seems reasonable. I'll test this when I get off work. Thanks,
Copy linkTweet thisAlerts:
@mousebearauthorMar 20.2007 — Onload() seems to trigger fine when this reference file changes. However, I have another IFRAME with a similar HTML file that does not. Both situations have HTML files loaded in IFRAMES. However, the HTML file that fires fine replaces itself; while the one that doesn't fire gets replaced by a function triggered from the other IFRAME HTML file (the same file that replaces itself). That function does something like TARGET = PARENT....

That explanation seems so confusing even for me to read. Let me know if by some miracle you can grasp the condition and see a solution. If not, I will include some code when I get off work.
×

Success!

Help @mousebear 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.17,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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