Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 12th, 2007, 08:54 AM
Registered User
 
Join Date: Apr 2005
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default Reload page only once.

Hi, what is the best way to reload a page only once when user visits it.
I tried using <META ..> but as we have to specify seconds and after that second it will be refeshed again, is no use for me.
also tried with onload function but it keeps the page busy by refreshing.

In short, when user logs/visits page it should automatically refreshed but only onece.

Thanks in advance.

Rupen Anjaria.:)
------------------
It is not difficult to be on TOP...It is difficult when you carry Truth,Commitment and Transparency with you.
 
Old September 13th, 2007, 02:22 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hi Rupen!!
Ofcourse you can do this with different ways.
to do so ,u need some kind of state management techniques.
if it is normal html/htm then u can use help of cookie
or if it is generated by server-side-code asp/php/aspx/jsp etc u can use
either form field,session or query string.

once a page is loaded check the value of a variable(session variable values on client side),
if it has initial value ,reload it and increment that value.

Hope this will help you,if u have any other concept plz share with us

Cheers :)

vinod
 
Old September 13th, 2007, 04:00 AM
Registered User
 
Join Date: Sep 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes it is possible, you can use a following function
window.setTimeout('CallMe()',limit);
  You can specify the time gap also to auto reload.
In this function try to load a session with that user. and load the page for every user once.
  May you got the logic..
Bye..

  Guru.

Guru
 
Old September 13th, 2007, 06:00 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hi Rupen!!

Since you want to reload the page only once. setTimeout function allows you to call "CallMe" function
after given timelimits,but how do u know whether the page should be reload or it is already reloaded.

e.g below code will reload the page in infinite times.

<script>
var i
i=0
window.setTimeout('CallMe()',1000);

function CallMe()
{
document.getElementById("mydiv").innerHTML=documen t.getElementById("mydiv").innerHTML+"--"+i
i++;
alert("j"+window.location.search);
location.href="tmp.html"

}
</script>
<div id="mydiv"></div>


++++++++++++++++++++++

http://www.javascriptkit.com/javatutors/send1.shtml
and next page http://www.javascriptkit.com/javatutors/send2.shtml?MyValue.value='JavaScript'&MyTest.valu e='Kit'


++++
Or
+++
here you can find out how to search a querystring .
http://www.eggheadcafe.com/articles/20020107.asp

U will have to send some info to the CallMe function ,when to reload it,for that
u have to use querystring,cookies,or if it is asp/jsp/php(server side lang) then user form fields.


Hope this will help you

Cheers :)

vinod
 
Old September 13th, 2007, 06:34 AM
Registered User
 
Join Date: Apr 2005
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default

Hey..the sission thing worked fine with me..

Thanks a lot.....

Rupen Anjaria.:)
------------------
It is not difficult to be on TOP...It is difficult when you carry Truth,Commitment and Transparency with you.





Similar Threads
Thread Thread Starter Forum Replies Last Post
reload parent page from included page sbkumar Javascript 2 July 24th, 2008 03:56 PM
Reload page Tooltip not work - Reload xslt file? ismailc XSLT 10 January 22nd, 2008 10:03 AM
I want page to not reload omersharp ASP.NET 2.0 Professional 0 December 13th, 2006 07:06 PM
Reload ASP page once only pablohoney Classic ASP Basics 2 August 10th, 2005 10:19 PM
Reload a page mivan2001 Javascript How-To 1 July 23rd, 2003 03:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.