Hey! Is it possible to make javascript do something when an iframe has finished loading?
I have my page that loads up anotehr site in the Iframe, and I need it to know when the Iframe is loaded..
Thanks in advance
Hey! Is it possible to make javascript do something when an iframe has finished loading?
I have my page that loads up anotehr site in the Iframe, and I need it to know when the Iframe is loaded..
Thanks in advance
You just need to know when it's loaded, or you want the onload event to trigger something in the parent window?
And after the amount of problems I've had with iframes over the last couple of weeks, I'm going to take your legs away for using them.
sig removed by Zak33
Lol!! They are a bit tough, but i like them
Yeah, I just need to know when they have loaded.. Then want to run some script in the parent window, tat does stuff in the Iframe.. fun :S
<body onload="doSomethingToParent()">
then a JS function
function doSomethingToParent()
{
document.parent.whateveryouwanttodo;
}
as you may have guessed, if you can't tell us what you want to do it become pretty difficult to write code for it
Applecrusher....they're not tough, they're just silly. And a pointless waste of time. Why add another level of complexity, especially when you're using a scripting language that you want to talk together? Is it because you think it loads faster? Or because you like that one page changes without changing the rest of the page?
(Can you see that I've tried to rationalise using Frames prior to this rant?)
It's all false. It's not faster, it's not nicer, it's just poo. Don't do it, it's not worth it...
And if you're determined to stick with it, do what Iain said...
sig removed by Zak33
lol... I use iFrames for fast-looking searching... its not that it actually is faster or better, it just looks nicer to the end user.
I'm using callbacks to an iFrame that runs SQL stored procs based on input in up to 3 boxes... looks lovely and mimics a true application much better - I program for idiots, so we need to make it behave as simply as possible. The less buttons etc they need to press, the better. iFrames are just nice because I set them to invisible via css
And yes:
parent.functionName()
works fine
If the only reason you're using iframes is so you can hide them from the user then just use a div and set to to have an x and y position in the negative, i.e. outside the browser window. If it needs to run SQL stored procs without refreshing the page then use and XMLHTTP request in the same way as I've done on the search box on the main HEXUS site. Just type in a search and once you've entered 3 characters it starts predicting the results using an XMLHTTP call to the database. Dead easy to implement and infinitely better than iframes
I cant do that, as i dont have control over what is in the IframeOriginally Posted by Iain
What I am aiming to do it have my Iframe help me with online games, it goes and does little things for me, but for these games, I cant edit the pages (obviously), so i need my page to know when the Iframe has loaded...
And if someone can give me a better way to do this than with Iframes or frames, i would be greatful
Tell us the game site so we can see if there's any way to parse it's content
www.darkthrone.comOriginally Posted by Iain
If you want to log in, add me to msn and ill lend you my old username and password
I created an account, which page is it you are trying to use ?
One trick you could use would be to use something like setTimeout to keep looping until you find you can access the body tag through JavaScript.
I've never tried looking for an element within the page i cannot control as my code checks for the state of a flag but this MIGHT work.Code:function checkLoadState() if (iframe.window.body) { //Do whatever you need } else { setTimeout("checkLoadState()", 1000) }
Nick
Abit IP-35 Pro, Core 2 Quad Q6600 @ 3Ghz, 8800GTS 512, Zalman Reserator1 External Watercooler, 4GB DDR2, 76GB Raptor 10k, 300GB Seagate Barracuda 7200.10, 2x Maxtor 250GB 7.2k, ViewSonic VP201s & Dell 2408
in the recruiter, I want to run the part function that enables the picture.. not quite legal, but mehOriginally Posted by Iain
I'm not going to help you break someone else's site by hammering their bandwidth.Error
Due to players using automated programs which hurt our site, refreshing has been disabled. Please use the recruit! button on the recruiter. Click here to continue.
Damn, that only just popped up too!! Arrgh!! And i thought I was the only one smart enough to think of this!! Ohh well.. I'll just do it the old fassioned way
Thanks anyway
There are currently 1 users browsing this thread. (0 members and 1 guests)