How to refresh page on back button click?
Try this... not tested. I hope it will work for you.
Make a new php file. You can use the back and forward buttons and the number/timestamp on the page always updates.
<?php
header("Cache-Control: no-store, must-revalidate, max-age=0");
header("Pragma: no-cache");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
echo time();
?>
<a href="http://google.com">How to Refresh Page on Back Button Clickaaaaa</a>
Or
found another solution
The onload event should be fired when the user hits the back button. Elements not created via JavaScript will retain their values. I suggest keeping a backup of the data used in dynamically created element within an INPUT TYPE="hidden" set to display:none then onload using the value of the input to rebuild the dynamic elements to the way they were.
<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();}
}
How to refresh a page after back button pressed
The Navigator.push
method returns a future of the generic type of the Route:
Navigator.of(context)
.push(new MaterialPageRoute<String>(...))
.then((String value) {
print(value);
});
And inside the new route, when you have the value you need:
Navigator.of(context).pop('String');
Refresh page on back browser button
Although your questions is very poorly written, I believe it is more important that you get the answer you're looking for.
Do the following:
- Add event listener to the window/document(in your case, keydown)
- Get the ascii code of backspace(0x08 or 8 in decimal)
- Prevent the default functionality of keydown
- Refresh the page if it is backspace
Here it is in code.
window.addEventListener('keydown', function(e)
{
if( e.keyCode == '8' )
{
e.preventDefault(); // prevent backspace from going to browser
// history
// add reload code
location.reload();
}
}, false);
Link to event listener
MDN Event Listeners
Chrome 41: Force Reload when pressing the back button
Please check this question that addresses the problem using localStorage/sessionStorage.
Related Topics
Encrypt With PHP, Decrypt With JavaScript (Cryptojs)
In JavaScript How to Make a "Click" Event Fire Programmatically For a File Input Element
Get Cursor Position (In Characters) Within a Text Input Field
Determine If an HTML Element'S Content Overflows
Link Index.Html Client.Js and Server.Js
Should Setting an Image Src to Data Url Be Available Immediately
How to Link a JavaScript File to a HTML File
Calling a JavaScript Function in Another Js File
Retrieving the Text of the Selected ≪Option≫ in ≪Select≫ Element
How to Show Progress Bar While Loading, Using Ajax
Convert Data Uri to File Then Append to Formdata
Is It Wrong to Place the ≪Script≫ Tag After the ≪/Body≫ Tag
How to Wait For the 'End' of 'Resize' Event and Only Then Perform an Action
How to Get Numeric Value from a Prompt Box
(Html) Download a Pdf File Instead of Opening Them in Browser When Clicked