why not just put that in the src of the iframe tag straight up?
Dave Stolie wrote:(What is a quick and easy photo hosting/sharing site? I can post a screen shot detailing the two requests.)
This is why I can't hard code the iframe's src.
Eric Pascarello wrote:What do you mean exactly frames are being loaded twice?
Eric
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?
Rob Hunter wrote:"What is wrong with the sample provided?" The problem was that the example was using javascript when you didn't need javascript. If you are just going to use javascript to set the URL to the same thing then why not just set src straight up? You mentioned some dynamic setting of of the URL for the frame but your examples don't show anything of that nature. You have the url hardcoded in the javascript. I'll assume what you are trying to accomplish and this example are 2 different animals and that this is just test code.
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?
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?
What are you doing in my house? Get 'em tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|