Solved

how can I referesh my page?

Posted on 2016-10-18
4
32 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now