Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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

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

you can't

Imar
Reply With Quote
  #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

Reply With Quote
  #4 (permalink)  
Old September 22nd, 2005, 04:49 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 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.
Reply With Quote
  #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

Reply With Quote
  #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
Reply With Quote
  #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/-

Reply With Quote
  #8 (permalink)  
Old October 11th, 2006, 04:58 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 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.
Reply With Quote
  #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

Reply With Quote
  #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)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 02:27 AM.


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