Rob Hunter wrote:Dave, not sure if you missed it or not but I posted again after the post you quoted. Since the code looked rather simple I thought that you may have been having problems with the scenario you were talking about but trying to take out all the sensitive code to simplify for the readers. My apologies. I don't think the iframe is loading twice but rather just unaffected by the refresh. If you try and set the url to something else before the www.google.com and break you'll likely find it doesn't take. I think once you've set the iframe it's there, in this case anyways. I haven't tried it but I'd be curious to see what would happen if you called a similar script on the onclick of a button after the page has fully loaded. Would you be able to change the src then after a refresh? If you find out anything could you post your findings?
Here are 2 things to try:
A) iquery - look at calling the function once the page is finished loading using this library
B) instead of using onLoad just have a script at the bottom that calls the script at the top.
Just a few things to try. You have the src set to "x" in your example, is this what you've actually tried? When the alert gets hit has the iframe already loaded www.google.com? What is in the iframe when the laert gets hit if this was not the case?
Bear Bibeault wrote:
This is why I can't hard code the iframe's src.
Not grokking that. The type of content (JSP or HTML) has nothing to do with the URL that you assign to the frame.
However, if the URL needs to be dynamic for some other reason, why aren't you determining it on the server and dispensing with all the client-side machinations?
why not just put that in the src of the iframe tag straight up?