/    Sign up×
Community /Pin to ProfileBookmark

IFrame that doesn’t affect the history.

In my page I need to be able to display my basket which is located at external URL (and must be located there) in a div that floats above the content of the page and opens and closes when items are added to the basket. I know this can easily be done with an iframe and some JavaScript and CSS but if the user clicks a link inside the basket it is recorded in the history and consequently when it is closed pressing the back button appears to have no effect (in IE it actually gives an error because the iframe has been destroyed so it can’t send it back.)

I have tried recording the number of times the iframe’s onload event fires and then using history.go(1 – i); where i is the number of times the onload has run (the 1 – is to take into account the first onload which doesn’t register in the history) but this doesn’t work because if the user uses the back or forward button the onload event fires but it is not recorded in the history.
So does anyone know of a way of stopping the iframe from messing up the history?

P.S. It doesn’t need to necessarily be done with an iframe as long as it can display the external page and allow navigation but not interfere with the history.

to post a comment
Full-stack Developer

1 Comments(s)

Copy linkTweet thisAlerts:
@potedauthorJan 09.2009 — bump
×

Success!

Help @poted spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...