473,397 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

How to refresh page ONCE onload?

I've been searching on how to not get a cached version of my page. I've tried adding meta tags and even used an apparent 'cheat' by adding a second head after the body, this doesnt' work either. I do not want a timed refresh, rather, everytime someone goes onto the page it is the most recent version. Also added a function and called it onload but that just keeps going in an infinite loop. Can someone please help me? Much aprpeciated!
Mar 23 '07 #1
9 37647
DeMan
1,806 1GB
Hi (again) Zafarana,

Please direct techniacl questions to a specific forum. I think the answer you are looking for may be in an html tag, rather than JavaScript, so I'll pass you on to the HTML forum. I hope they can give you a sufficient answer.
Mar 23 '07 #2
AricC
1,892 Expert 1GB
I've been searching on how to not get a cached version of my page. I've tried adding meta tags and even used an apparent 'cheat' by adding a second head after the body, this doesnt' work either. I do not want a timed refresh, rather, everytime someone goes onto the page it is the most recent version. Also added a function and called it onload but that just keeps going in an infinite loop. Can someone please help me? Much aprpeciated!
Show me the meta tag you've tried. Have you tried:

Expand|Select|Wrap|Line Numbers
  1. <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
  2.  
Mar 24 '07 #3
I see how this works using

Expand|Select|Wrap|Line Numbers
  1. <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
but what would you do if you have a common header, include or master page, that you do not want the no-cache to be applied to? In other words I just want one specific page to refresh everytime on load but I am using a common header throughout the site and do want everypage to have this.
Dec 6 '07 #4
Markus
6,050 Expert 4TB
<meta http-equiv="refresh" content="2; url=">

is that the sort of thing you want?

Content is the amount of seconds it takes untill the page is reloaded. url is, well i think you know what that is ;)
Dec 6 '07 #5
drhowarddrfine
7,435 Expert 4TB
If you have access to your server settings, you can set the header to "expires" and the date. Or you can use the <meta>:
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 2008 08:21:57 GMT">

I'm not sure the meta version works anymore.
Dec 6 '07 #6
clai83
41
If you have access to your server settings, you can set the header to "expires" and the date. Or you can use the <meta>:
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 2008 08:21:57 GMT">

I'm not sure the meta version works anymore.

If you are willing to do some PHP then here is some code that will help you

[PHP]
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
header( 'Cache-Control: post-check=0, pre-check=0', false );
header( 'Pragma: no-cache' );
?>
[/PHP]

Put this code on the very top of your html page. Rename that page to .php extension.

!!!! Make sure that there are absolutely no spaces before the above snippet. If there are you will get an error.
Dec 7 '07 #7
drhowarddrfine
7,435 Expert 4TB
PHP is off topic in the html/css forum. To offer a PHP solution to someone who may not even use PHP is not helpful either.
Dec 7 '07 #8
Hi,

I just wanted to say THANKYOU for the PHP solution its exactly what i was looking for, as for the moderator who posted stating that he was not looking for a PHP solution and should not post here, well, it was never stipulated in his original post that he required only HTML and further more people looking for solutions are looking for just that, surely the same question shouldn;t be posted in each different topic depending on the language yuor using for the same problem!

Google returned my result and directed me here, any how, thanks again for the PHP!!! :-)
Jan 11 '08 #9
Thanks for the PHP solution! I know it's off-topic, but it worked great...
Feb 29 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Willem | last post by:
Can someone tell me how I can get a page(any page) on the Internet to refresh automatically every 5 minutes. I was thinking along the lines of having a HTML file on my C-drive with JavaScript to do...
4
by: Lex | last post by:
I want to reload a page only once. Therefor meta refresh is not suitable, because then it refreshes every x seconds. Is there a possibility to refresh only once? regards, Lex Ouburg
1
by: PawelR | last post by:
Hello group. Sorry my english is very littel but I try explain my problem. In my www aplication I have long page (about 4 screen). On the bottom of my page is DataGrid. If I change state this...
8
by: TS | last post by:
Im in a web page and call an asynchronous method in business class. the call back method is in the web page. When page processes, it runs thru code begins invoking the method then the page...
1
by: achoo | last post by:
Is it possible to extend a Web service proxy so that it understands an HTTP refresh page? Explanation: * The Web service proxy was autogenerated by Visual Studio .NET 2003 from the Web...
10
by: phforum | last post by:
Hi, I wrote a PHP page for user input the information to search the database. And the database data will update every second. I want to set the auto refresh to get the data from database every...
0
by: vinodkus | last post by:
dear sir/madam Please tell me how to refresh page using using code behind Thanks in advance
3
by: tvnaidu | last post by:
How to auto refresh page for every 3 minutes by passing command part of URL?. I need to refresh one page automatically by passing that refresh command part of url, for example if I want to refresh...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.