Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to have back button go back one page, not one iframe!

Status
Not open for further replies.

jonnyGURU

IS-IT--Management
Aug 19, 2004
138
US
I've gotten myself into a pickle. I made a page where an iframe loads onmouseover. The thing I didn't realize is that EVERY TIME the iframe loads another page, the browser registers that in history. So if you change the iframe a dozen times on that one page, you have to hit the BACK button at least a dozen times to go back one page!

Is there a way to use the history object to perhaps grab what page they came from, and then take them back to that page when they hit the back button? Or is there someway I can prevent the iframe from loading in history at all?

Thanks!


Dispensing quality rants and mishaps since 1999:
 
Hmm, you could try storing the number of times a user has loaded an iframe by incrementing a counter in the mouseover event.

then, when you want to go back (using javascript, not using the back button), you could just say [tt]history.go(-(varName));[/tt]

*cLFlaVA
----------------------------
[tt]tastes great, less filling.[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Well, that would work if I could trust a person would use a javascript back button. I've got navigation along the top of the page, so if they'd use a javascrip back button, they'd use the navigation. If they'd use the navigation, there wouldn't be a problem. :) You know how that goes.

I've almost contemplated just making each iframe page an image and just have the onmouseover change the image instead of the iframe! But what a pain to convert pages into big images just to please someone that can't use navigation. :(

Dispensing quality rants and mishaps since 1999:
 
I dont know if it will help you, but you can try like this:
- in the main page when this is loaded, you can store in a javascript variable the referrrer (which is the previous page), let's call taht var 'prev_page'
- On BACK button, you can try: top.location=prev_page;
Instead of top, you can use a name of the main window, but the top mean the TOPest frame/iframe.

HTH





___
____
 
cLFlaVA, don't forget the backspace key!!!

-kaht

Weaseling out of things is important to learn. It's what separates us from the animals... except the weasel. - Homer Simpson (no, I'm not Homer)
 
Haha... Well guys... I gave up. :p

Apparently there's no way to NOT see each load of the iFrame as a new page in the history.

So I turned the content of each iFrame into a big image, got rid of the iFrame and just have the new image load onmouseover instead of a new iFrame.



Dispensing quality rants and mishaps since 1999:
 
Haha... Well. It worked great with the iFrame, but like I said... 12 clicks, and 12 reloads of the iFrame later, you have to click back 13 times to get back to where you came from unless you used the provided nav bar.

I think we might opt for flash in version 2.0. ;)


Dispensing quality rants and mishaps since 1999:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top