Solved

how can I referesh my page?

Posted on 2016-10-18
4
63 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 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