Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 20th, 2005, 02:09 PM
Authorized User
 
Join Date: Jul 2004
Location: , , India.
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default Browser history

Hi

How to Clear the Browser History using Javascript

quick response would be appreciated

Cheers
Abdul

  #2 (permalink)  
Old September 20th, 2005, 03:26 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

you can't

Imar
  #3 (permalink)  
Old September 22nd, 2005, 04:05 PM
Authorized User
 
Join Date: Jul 2004
Location: , , India.
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

can i know how u said it's not possible

  #4 (permalink)  
Old September 22nd, 2005, 04:49 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
  #5 (permalink)  
Old October 4th, 2005, 04:17 AM
Friend of Wrox
 
Join Date: May 2004
Location: , , .
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Cheers
Joe

  #6 (permalink)  
Old October 4th, 2005, 05:00 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

its not recommended adbul

www.crmpicco.co.uk
  #7 (permalink)  
Old October 11th, 2006, 04:53 AM
Registered User
 
Join Date: Oct 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

  #8 (permalink)  
Old October 11th, 2006, 04:58 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
  #9 (permalink)  
Old October 11th, 2006, 05:18 AM
Registered User
 
Join Date: Oct 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

  #10 (permalink)  
Old October 11th, 2006, 06:00 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

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)




Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding url to browser history Manoah Javascript 0 July 5th, 2008 02:22 AM
Web Browser History & Bookmarks switch720 VB How-To 0 August 1st, 2006 03:12 AM
History data stagedancer SQL Server 2000 2 December 8th, 2004 09:57 AM
Window.History pvasudevan Javascript 5 September 4th, 2004 03:49 AM
Record History cdenequolo Classic ASP Basics 2 December 3rd, 2003 12:44 PM





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