• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

java script

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there is any way in java script by which I can change browser history.
For example what I want to clear the contents of history object
when user visits the particular page of my web site....
thanks in advance
ninad
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ninad
You can't clear the history object of the browser - most users wouldn't appreciate that anyway. The only thing you can do is use the location.replace method to replace a current entry in the history with a new page/location. Use something along these lines:
location.replace(fileName);
Keep in mind that it is often neat to be able to do tricks like this with the browser and to control the users interface (sometimes it's very vital that you do) but the users often feel that the browser is theirs and it should look, feel and behave the way they want to. Remember what looks cool and neat to us geeks is often irritating to the user. Just my $.02.
hope this helps you
Dave
 
ninad parkhi
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx for ur reply.
But my problem is I am having 100's of html/jsp/servlets in ,y project.And nearly most of them wants history to be deleted for security concerns.
So do u think using "location.replace(fileName);"is good idea ???
Please give ur thought on this...
ninad
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As for whether or not it is a good idea, that depends on the project or reason for it. If it for design or navigation purposes then that would be ok. for instance of the user selects a choice about their preferences for someting then you can take them to a page based on those preferences and replace the history with that page so they don't accidently go back to the choice menu again (that's a fairly lame example, sorry).
As for your problem, why do the pages in your app need the history to be deleted? If you really have to have it done you can just include a piece of Javascript to set the history to a default page or to null. That way of they go back to it then they end up at a default page that says they did something wrong or that they can't go back. The other option you have is to run the pages in a window that doesn't have any toolbars then there is no back button for them to use (they can still right click though and get a 'back' command on the menu).
If you need more info, send more details on your particular reasons and the what functionality you need.
Dave
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I attempted the
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
location.replace("/timeentrysignon.jsp");
</SCRIPT>
It just forwarded me to that page, which was not what I expected. Any idea why this happened???
 
CAUTION! Do not touch the blades on your neck propeller while they are active. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic