/    Sign up×
Community /Pin to ProfileBookmark

need to block new entries in browser history when opening links to targeted iframe

Hi everybody,
I have a page in an iframe whose links open up to another targeted iframe and I am trying to have the browser not put an entry in the history list when this happens, so when they click the back button it wont affect the new location of the targeted iframe.
I have tried several different things using location.replace() and history.previous but nothing seems to do exactly what I am looking for.

If this may help, the last thing that I tried that almost worked was putting this:
<body onunload=”javascript:location.replace(this.href);”>
on the html of the new page being loaded
it did not put any entries in history for the iframe, but you would have to click the link twice, and it would open the wrong page in between.

I also tried something like this on the links:
<a onclick=”javascript:frames[‘mediaplayer’].location.replace(‘newlink.html’);”>
(mediaplayer is the name/id of the iframe the link are to open in)
but it was giving me an error saying it is not an object or is null

Hopefully someone can understand what I am saying and can give me a kick in the right direction.
If you need an example of the page I can put up links.
Thanks for any assistance, it is MUCH appreciated!

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@blah1985May 23.2006 — You can not edit the users History. There are a few methods to prevent the back button. For example, you could open a new window(prob not practical in your case. Also, you could just write the data into a div or a js redirect.
Copy linkTweet thisAlerts:
@TheBearMayMay 23.2006 — Please don't cross post.
×

Success!

Help @zeq 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 5.16,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...