p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Javascript How-To (http://p2p.wrox.com/forumdisplay.php?f=87)
-   -   Browser history (http://p2p.wrox.com/showthread.php?t=33553)

abdul_owiusa September 20th, 2005 02:09 PM

Browser history
 
Hi

How to Clear the Browser History using Javascript

quick response would be appreciated

Cheers
Abdul


Imar September 20th, 2005 03:26 PM

you can't

Imar

abdul_owiusa September 22nd, 2005 04:05 PM

can i know how u said it's not possible


Imar September 22nd, 2005 04:49 PM

You asked for quick response, so I gave you one ;)

Anyway, the browser's history is something a page / JavaScript cannot control. Only the user can clear the history. If you think of it, you should be glad that's the case. How would you find it if some site just cleared your history, so you couldn't go back to a previous page, like search results in Google?

There are ways to stop your pages being added to the history. You can use location.replace instead of location.href. The results of this may vary, though....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.

interrupt October 4th, 2005 04:17 AM

You could load an instance of Excel and use it's Sendkeys method.

Cheers
Joe


crmpicco October 4th, 2005 05:00 AM

its not recommended adbul

www.crmpicco.co.uk

vishals October 11th, 2006 04:53 AM

hi Imar
can u advice me the ways to stop your pages being
added to the Browser's history
thnx and rgds/-


Imar October 11th, 2006 04:58 AM

Like I suggested earlier: with location.replace.

So, instead of regular <a href> tags, use JavaScript with location.replace.

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.

vishals October 11th, 2006 05:18 AM

hi, imar
thnx for ur quick reply

i m using 3 aspx pages. webform1.aspx,webform2.aspx,
webform3.aspx. all the three pages are linked after one another.
what i want to do is, i want to restrict the user from viewing
webform2 page after he reaches to webform3. in other words user
after reaching on webform3 the browser's back button shud get
disabled. i tried using history.go method but it affects redirection of
other hyperlinks on the webform3 page.
in this case how do i use the location.replace() method. and on which page/event should i use it?
wht can be the possible solution?
thanks and regards


joefawcett October 11th, 2006 06:00 AM

What you're asking is impossible, you can't prevent the user going backwards by controlling the browser. You need to re-think the design and enforce the requirements server-side.

--

Joe (Microsoft MVP - XML)

Imar October 11th, 2006 01:00 PM

I agree with Joe. While it's possible to prevent a few pages from being added to the history using replace, it's NOT a fool proof solution. Server side checks are they only way to guarantee a certain path in pages a user is allowed to follow.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to: Wasserturm by Einsturzende Neubauten (Track 13 from the album: Zeichnungen Des Patienten O.T.) What's This?

vishals October 13th, 2006 09:13 AM

Quote:

quote:Originally posted by Imar
 I agree with Joe. While it's possible to prevent a few pages from being added to the history using replace, it's NOT a fool proof solution. Server side checks are they only way to guarantee a certain path in pages a user is allowed to follow.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to: Wasserturm by Einsturzende Neubauten (Track 13 from the album: Zeichnungen Des Patienten O.T.) What's This?


All times are GMT -4. The time now is 04:17 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.