/    Sign up×
Community /Pin to ProfileBookmark

jump page in history when going to .pdf file

Hi, when using location.replace(url) on my jump page, the jump page does not go into the history unless it is a .pdf file. We are getting complaints from users because they have to hit the back button twice to get back to the original page, or people complain that they are in a loop (hit the back button once, then get redirected to the .pdf).

Below is my code… Any suggestions on how to get around this??

Thanks in advance..
Nik


————————

jump page code:
<html>
<head>
</head>
<body>

<SCRIPT LANGUAGE=”JavaScript”>
<!–
if (document.images)
{
location.replace(‘http://www.globalspec.com/MediaKit/PeakToPeak_July03.pdf‘);
}
//–>
</SCRIPT>
</body>
</html>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliAug 19.2003 — window.location.replace()

will replace this page in the history therefore if you try to go to go(-1) you will be sent back to this pagethe new url that replaced the previous one


if there is no specific reason to use replace...

use

location.href=url
Copy linkTweet thisAlerts:
@nikrauthorAug 19.2003 — neither window.location.replace() or location.href=url work.

loction.replace() works only when you are not going to a .pdf file. If you go to a .pdf file, the jump page gets put in the history... If it is a normal web page, the jump page does not get put in the history.

Any other suggestions?
×

Success!

Help @nikr 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.19,
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,
)...