View Full Version : Setting a default for an targetted link into an iframe.

Captain P
06-23-2008, 04:39 PM
Right, this is probably the world's most stupid question. I have a site with three iframes on the homepage. One of them is there to indicate different levels. I have this set so I can click on a link and target that iframe. My problem is that, when the page refreshes, the iframe goes back to being blank. Is there any way that I can set the default to the last page populated?

06-23-2008, 04:52 PM
This actually varies by browser. The default in Mozilla based browsers like FF is to repopulate all iframes and frames with whatever they were showing. IE is different, generally reverting to the page as it was when first loaded, but sometimes not.

There is no way to ensure what you are talking about via javascript. Users can always disable it. And folks generally know what their browsers will do on refresh, so this really isn't anything to worry about. But if you wanted to set it up so that at least people with javascript and cookies enabled would have a smoother experience, you could set a cookie and read it on page load.

However, some people would want the refresh to act as they are accustomed to it doing, and would therefore be disappointed by your manipulations.

A more fool proof method should be able to be developed using server side code.

Captain P
06-25-2008, 12:44 PM
Thanks for this. I'm wondering if I could achieve what I need with an iframe redirect?

06-25-2008, 01:02 PM
If you mean by having the user logged in somehow (generically as the current user, or specifically as that user with a specific account), and setting or having already set their level and using that information for redirect on the default page (src attribute of the iframe), yes. That should be able to be done in most server side languages.

Do you have a server side language available to you, and if so, have you been using it at all?

Captain P
06-25-2008, 01:14 PM
Basically I've designed an internal company management information site. My problem is that I need to display alerts on a scale from 1 to 7. I've created a command console with links to an iframe on the homepage but it's not populating on any pc but my own. The default is 4 so I have this selected but the problem with that is that on refresh the iframe reverts to 4.