Dave Stolie

+ Follow
since Apr 28, 2009
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dave Stolie

It does, thanks!!

You guys who take your time to help out others are awesome It is appreciated.
14 years ago
Is it possible to append text to a column result within the query itself? The way our system is, I need it to return the result wrapped in the CDATA tag. The below doesn't work, but should illustrate the idea on line 4:
14 years ago
Hey Rob, thanks for the attention you have given to my issue. Don't be spending much of your time on this. I am pretty confident it is browser behavior in how it handles the iframe on refresh. I opened the code through FireFox, then I changed the URL in the file, saved, then refreshed the page. It proceeded to reload the original URL (prior to the refresh), then triggered the onLoad function loading the iframe with the new URL.

I'm not at all familiar with JQuery. Though, my first thought is that either the issue will still happen with that JavaScript library, or there is a simple alternate route used by JQuery that someone else might know of that I could do here. I could be wrong, but I don't think it would be prudent to load a large library just to do such a simple task. But, I guess if it was the only way...

Like I said, you don't need to spend any more of your time on this unless its for your own edification. Your help has been appreciated, thanks.

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?

Yea, I didn't catch your other reply before I posted mine, no need to worry about it. I am just focused on a solution to the double request

The refresh, in fact, is affecting the iframe. If I load the page and then hit refresh, I get a total of three requests for the URL I am setting the iframe to. The initial request is set by the first onLoad javascript call. Then I hit refresh, a request is sent out for the iframe, and then the onLoad is called triggering the third request.

It is the request that happens between hitting refresh and the onLoad function that I do not understand. There is no instruction in the page to tell it to load prior to the onLoad call. I am assuming the browser is doing this and I have no control over this. To get around it, I am wondering if it is possible to tell if the iframe has already been loaded before setting its source. Trying to get its src value just returns what is in the hard coded HTML code even though the browser already made a request to the URL it was set to prior to the page refresh, so I am at a loss on what to do.

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?

My question was concerning the reloading twice of an iframe upon hitting refresh. I didn't want to complicate the code provided that was to demonstrate the problem at hand. I stated at the beginning why it is set by javascript and not simply hard coded and wanted to keep the sample focused to the problem at hand (Frame loading twice on refresh). I guess trying to cut things down to simply demonstrating the problem only exacerbated the attention away from the problem... I do appreciate your concern and looking into the matter. I can add the other javascript function that pulls a URL param. and appends it to the end of the URL to make it more like the actual case if you would like to see it.

I just tried setting the src to x in an attempt to try to see if the frame had already been set prior to setting it again by the javascript, causing the second load. I figured that since google was already loaded by the refresh in the frame prior to the onLoad call, I could get it's src value and not set it if google was already loaded. But, this did not work as even though google had been reloaded, I was still getting the value of /x as the src, thus still reloading google twice. I attempted this because I believe it is the browser trying to be like Microsoft in doing stuff it thinks you want it to do, even though it is more often then 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?

I am stuck with this. The project I am working on is being done in two parts. One team is doing the designing of the page and hosting most of the pages on their server. Their pages are not JSP pages or anything that is generated by some logic, but plane simple HTML files. My part of the project is to provide the site with functionality to log a user in, allow them to update some info, and then send them over to a third party vendor which handles some ordering. All of the business logic is done by us. Their files are being hosted on their server under the site's URL and they are using frames to consume the user management functionality hosted by us while remaining under the same URL.

The reason the src of the iframe on this page is set through javascript is because I have to send a user to their (the other teams) static HTML page and pass along a session ID. Then the javascript sets the src of the iframe to a URL which consists partially of that session ID so they can then make the call back to us. The whole process is working fine with the exception of when a user hits refresh on a page. It is then making the call to us twice each time they are doing so.
The highlighted row is the start of the second request. All this is from after the page first loaded, starting upon hitting refresh.

Eric Pascarello wrote:What do you mean exactly frames are being loaded twice?


The iframe is making two requests to populate its frame contents. It is actually making two calls to google, loading it twice.
What is wrong with the sample provided? I replaced the url with http://www.google.com and it loads the URL twice in the frame for me using FireFox 3 and IE 7 when I hit refresh. (But not on Safari for Win XP)

(What is a quick and easy photo hosting/sharing site? I can post a screen shot detailing the two requests.)

The only thing I can think of is that the browser is trying to be 'smart' reloading the frame itself. It is reloading once before the javascript. Then once it is reloaded, it is then running the onLoad javascript function loading the frame again. If this is actually the case, how do I prevent it from being loaded a second time?

I tried the following with no luck:

why not just put that in the src of the iframe tag straight up?

The specific URL is dependent on a URL parameter. The page the iframe is on is a just a simple htm page that is not under my control. It is not a JSP page or anything that dynamically creates it's content. This is why I can't hard code the iframe's src.
Hi all!

I have a problem. I am using frames and when the page is being refreshed, the frame is being loaded twice. This is the scheme I am using.

The javascript sets the frame because the URL is dependent on some URL parameters. But anyway...

Why is the frame being loaded twice when I hit refresh? It is loading it twice in IE 7 and Firefox 3, but not in Safari 3 (for win xp).

And of course for the real question, how do I get it to load only once!?