NameSilo

Question about back-button behavior within iframes

Spaceship Spaceship
Watch

JesseLee

New Member
Impact
0
I have an iframe into which I will be loading various documents of my own creation. I would like to put a javascript back-button on these documents, which will allow the user to return to what was previously in the iframe.

I've tested this out on a couple of browsers with no problem but I know it is a troublesome area and want to make sure. Am I running the risk that on some browsers this button will take the user out of the page altogether?

More importantly, are there any situations where this could lead to the risk of loading external pages into the iframe? For example, if Bubba navigates from google to mysite, and then immediately clicks on the back button on the document in my iframe, is it possible that google might be loaded into the iframe?

The desired behavior is:

-user navigates from google to mypage and sees document A in the iframe
-user follows a link which loads document B into the iframe
-user then selects back button on document B and document A reappears in the iframe
-user then selects back button on document A and google replaces mypage (not in the iframe)

The reason I need a non-absolute back button is that there are a large number of these documents (A, B, C, etc.) and no way of knowing the order in which they might be viewed. Document A appears initially, but it might also reappear at a later time, so it would be irregular to just leave the button off of document A.

Thanks for your thoughts.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
what browsers did you test them in? in internet explorer (probably 4 or higher) I know that iframe activity is placed in the history no matter what. The regular back button for the browser will take you back through the iframe the same way you came. once it gets to the first page that was displayed in the iframe, it will go back to whatever refered it.

with a regular back button, it is impossible for the previous domain to be loaded into your iframe. I don't know how you coded your button, but I don't tihnk it would do that unless you have the back event being forcefully loaded into your iframe. I mean, actually giving it the destination of the name of your iframe. That seems possible, but probably hard to make it happen so i wouldnt worry about it. You can test this by making a little webpage that links to yours and click back :).
 
0
•••
thanks lemmin; the question of how iframe behavior is placed into the history is probably a much simpler way of phrasing my question :)

the code I'm using for the button is just
history.go(-1)

I've tested it on Safari and IE5 on a Mac, and both seem, as you say, to have a unique history entry for each iframe event. Makes sense, and makes me feel a lot better about including the button!

If anyone knows of other browsers that might handle this differently please let me know.
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back