• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JavaScript not working in Mozilla

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I have an issue where i need to redirect a user to home page if user presses the back button at the last page. For this i am setting a session value in my jsp at last page like <%session.putValue("page","last");%>.
And if user presses back button the session value is checked on the previous page. if value is found as "last", i have redirected the user to home page. This works fine in IE but not working in FF. I have even removed the cache via
<%
response.flushBuffer();
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Cache-Control", "no-store");
response.setHeader("Cache-Control", " max-age=0, must-revalidate, no-cache, no-store, private");
response.setHeader("Pragma", "no-cache");
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
response.setDateHeader("Expires", 0);
response.setDateHeader("Expires", -1);
%>
But still its not clearing the cache in FF. upon calling refresh only the page is getting redirected.
Any help in getting the page redirected will be appreciated. Please note i dont want to use window.history.forward(1) in my code. And there is no login/logout functionality implemented.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Thunder Bolt", please check your private messages for an important administrative matter.
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And where is the Javascript you are talking of ?
 
Gurvinder Singh
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
on first page following code:
<%
String homePageURL = request.getContextPath()+"/jsp";
%>
<script language="JavaScript">
var previouspage = "<%=session.getValue("page")%>";
if (previouspage=="last" ) { window.open('<%=homePageURL%>',"_parent");
}
</script>

on nextpage (ie last page) this is the code:
<% session.putValue("page","last")%>
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any time you try to change the way browser's work from within the code running inside one, you can expect problems like this.

As a user, I expect that clicking the browser's back button will take me to the previous page, not the first page. If the previous page was the result of a form post, I would expect the browser to warn me that continuing will cause the form to be reposted; with an option to cancel.

Why are you trying to change the way the back button works?
 
Gurvinder Singh
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The previous page here is refered to as the first page. and more over such warnings are seen in IE and not seen in FF.
Our project requirement is like we have to redirect the user to home page if he clicks back button on the last page...and so i have done but its working fine in IE and not working in FF.
 
reply
    Bookmark Topic Watch Topic
  • New Topic