Solved

how can I referesh my page?

Posted on 2016-10-18
4
46 Views
Last Modified: 2016-10-18
how can I refersh my page if user use back button on my web site?

I have a form which has a javascript function, if the user select one of my menü, the other menu comes up with the related data,
however if user use back button instead of the link, the second menu doesn't comes up with a data

if I refersh the page, problem will be solved.
my pages are php
0
Comment
Question by:Braveheartli
  • 2
4 Comments
 
LVL 1

Author Comment

by:Braveheartli
ID: 41848064
I use this code and it works

    <input type="hidden" id="refreshed" value="no">
<script type="text/javascript">
onload=function(){
var e=document.getElementById("refreshed");
if(e.value=="no")e.value="yes";
else{e.value="no";location.reload();}
}
</script>
0
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 250 total points
ID: 41848066
Another way is to use meta tags in head section

<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
<meta http-equiv="Expires" content="Mon, 26 Jul 1997 05:00:00 GMT">
</head>

Open in new window

0
 
LVL 2

Assisted Solution

by:Amita Singh
Amita Singh earned 250 total points
ID: 41848069
try this
window.onpageshow = function(event) {
    if (event.persisted) {
        window.location.reload() 
    }
};

Open in new window

0
 
LVL 1

Author Closing Comment

by:Braveheartli
ID: 41848072
thank you both
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question