Jump to content
xisto Community
Sign in to follow this  
kvarnerexpress

Refresh Page After Back Button Hit

Recommended Posts

REPLY-Refresh Page After Back Button HitRefresh Page After Back Button Hit

I would just say, use the following code

<script language="JavaScript">javascript:window.History.Forward(1);</script>

Thanks

Kamleshkumar Gujarathi

Share this post


Link to post
Share on other sites
back to parent page from child pageRefresh Page After Back Button Hit

I want to shif control or go back from child page to parent page. But child page will be used by meny parent page. May be it is uncommon but I can not specify the parent page name. It has select whatever its parent page.

-reply by arpita

Share this post


Link to post
Share on other sites
Oening a page by using buttonRefresh Page After Back Button Hit

HI,

I have created a HTML page with a bitton and I want to open a page when clicking the buton. I was able to do this but the page is opening in the same window. Could you please help me to open this page in a new window when ever I click that button. 

Thanks,

Rejith

Share this post


Link to post
Share on other sites

Hello,In fact, when you use back, if the page is reloaded from explorer cache, all javascript variables keep their previous values.So use that in order to by default have a value in the page (let say 0), then, when the page is loaded set this value to 1.on the onLoad event, check the value : if 0 then the page has just loaded, if not it is displayed from cache so let have it refreshed !here is the code :<script type="text/javascript">window.onload = function () { var rel = document.getElementById('forme').toBeReloaded.value; //get the current var value if (rel==1) { window.location.reload(); //loaded from the cache } else { // retrieved from the server (reloaded) document.getElementById('forme').toBeReloaded.value = 1; };}</script><form id="forme" name="forme"> <input type="hidden" name="toBeReloaded" id="toBeReloaded" value=0></form>

Share this post


Link to post
Share on other sites

Here's what I did, which works perfectly. I have a hidden input on my page called reloadValue. This will hold the date value (milliseconds) that's created by the function. If the control is empty when the page loads, the value is loaded into the control. If the control DOES have a value, and that value doesn't match the value just generated, the control is emptied and the page reloads. Note that I'm using jQuery, and telling the body to show in the IF statement. I have set the style of the body to display: none, so that it won't appear to load twice to the user--it just appears when we're all done with the (final) load.

$(document).ready(function()	{		var d = new Date();		d = d.getTime();				if ($('#reloadValue').val().length == 0)		{			$('#reloadValue').val(d);			$('body').show();		}		else		{			$('#reloadValue').val('');			location.reload();		}	});

Cheers!

Jay

Share this post


Link to post
Share on other sites

All, I have had a similar issue to what has been described above. It seems Firefox and Opera both share this problem, but I found aseamless result here.

I hope it helps you all as well as it did me, and I apologise if someone else above has already mentioned/linked to it.

Seeyez,

Niko

Share this post


Link to post
Share on other sites

Here's what I did, which works perfectly. I have a hidden input on my page called reloadValue. This will hold the date value (milliseconds) that's created by the function. If the control is empty when the page loads, the value is loaded into the control. If the control DOES have a value, and that value doesn't match the value just generated, the control is emptied and the page reloads. Note that I'm using jQuery, and telling the body to show in the IF statement. I have set the style of the body to display: none, so that it won't appear to load twice to the user--it just appears when we're all done with the (final) load.

$(document).ready(function()	{		var d = new Date();		d = d.getTime();				if ($('#reloadValue').val().length == 0)		{			$('#reloadValue').val(d);			$('body').show();		}		else		{			$('#reloadValue').val('');			location.reload();		}	});

Cheers!

Jay

This looks like the type of code I need to do what I want to do, I am a programmer, I understand java, but have never formally learned html enough to know how to create a hidden variable, and where things should go, how would I place this into my HTML document?

Thanks in advance.

Scott

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.