473,399 Members | 4,192 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,399 software developers and data experts.

Refresh page coding

I want to put a link on my web pages to allow the user to click and
refresh the page.

I have seen twqo ways to do this:-

<a href="javascript:location.reload(true)">
<a href="javascript:history.go(0)">

Are they both legitimate?

Is one better than the other?

Thanks for any info.

--
----------------
Stubbo of Sydney
----------------
Jan 12 '08 #1
4 1396
On Jan 11, 6:31*pm, Stubbo of Oz <stu...@invalid.invalidwrote:
I want to put a link on my web pages to allow the user to click and
refresh the page.

I have seen twqo ways to do this:-

<a href="javascript:location.reload(true)">
<a href="javascript:history.go(0)">

Are they both legitimate?

Is one better than the other?

Thanks for any info.

--
----------------
Stubbo of Sydney
----------------
you could also try

window.location.href = window.location.href

as in

<input type="button" value="Click here to refresh"
onclick="window.location.href = window.location.href" />

I make no promises.
Jan 12 '08 #2
Doug Gunnoe said the following on 1/12/2008 8:28 AM:
On Jan 11, 6:31 pm, Stubbo of Oz <stu...@invalid.invalidwrote:
>I want to put a link on my web pages to allow the user to click and
refresh the page.

I have seen twqo ways to do this:-

<a href="javascript:location.reload(true)">
<a href="javascript:history.go(0)">
Both are junk.
>Are they both legitimate?
Are they both legitimate junk? Yes.
>Is one better than the other?
Junk is junk.
>Thanks for any info.

--
----------------
Stubbo of Sydney
----------------

you could also try

window.location.href = window.location.href
....href + "?" + new Date().getTime()

might get you a better reload from the server. Reloading from the cache
is a waste of time.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 12 '08 #3
Thomas 'PointedEars' Lahn said the following on 1/12/2008 4:35 PM:
Randy Webb wrote:
>Doug Gunnoe said the following on 1/12/2008 8:28 AM:
>>On Jan 11, 6:31 pm, Stubbo of Oz <stu...@invalid.invalidwrote:
I want to put a link on my web pages to allow the user to click and
refresh the page.

I have seen twqo ways to do this:-

<a href="javascript:location.reload(true)">
<a href="javascript:history.go(0)">
Both are junk.
[...]
>>you could also try

window.location.href = window.location.href
...href + "?" + new Date().getTime()

might get you a better reload from the server. Reloading from the cache
is a waste of time.

That is why the `reload' method of Location objects accept `true'
for its first argument which avoids any of the other dirty hacks.
And then you have to hope that the browser, for whatever reason, honors
it. I have yet to see a browser that would reload from the cache using a
date timestamp querystring.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 12 '08 #4
On 1/13/2008 6:51 AM, Thomas 'PointedEars' Lahn wrote:
Anthony Levensalor wrote:
[snip]
>http://www.w3.org/TR/Window/

It's defined by the W3C as a long standing 'defacto standard',

It isn't.
It is in the W3C link I quoted. That's verbatim, not interpretation. And
all the times you've quoted the W3C drafts as a way to prove your point,
and now they're unacceptable? I'll remember that for the next time you
point to a draft and whine.
[snip]
>DOM level 0 wasn't even a real level, according to the W3C:

You don't say.
You suck at wrong. Too bad, because it's a condition I imagine you find
yourself in nearly perpetually.

--
anthony at my pet programmer dot com
Jan 13 '08 #5

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

Similar topics

1
by: Paul K | last post by:
I've recently started actual coding on a basic inventory- type intranet application and am running into a problem during prototyping. Whenever I make a change to an asp or html file, the changes...
4
by: John | last post by:
I get the feeling this is a pretty classic problem, but I'm a bit of an uber newber. Apologies! Products page, user enters a quantity and clicks one of my "Add to Cart" buttons, which bubbles up...
3
by: Damjan Vengu¹t | last post by:
Hey ! I have a WebForm with several controls on it (text boxes, buttons, datagrid, listboxes,...). I want to refresh the data in those controls every 1-2 seconds. How do I refresh (reload)...
4
by: Lenny Shprekher | last post by:
I am using regular server site ASP.NET button to execute function. Works fine, issue is that when I call page-refresh on IE after click I done it is calling same event again. Could anybody suggest...
15
by: tmax | last post by:
PHP Pros: I have a simple html form that submits data to a php script, which processes it, and then redisplays the same page, but with a "thank you" message in place of the html form. This is...
4
by: Phil | last post by:
Hi. A fairly basic sort of 'direction to go in' question of the type that can be hard to find an answer to! I am using ASP.NET (framework 1.1) to present data on web pages (IIS 5.0 / IE6) from...
1
by: rockdale | last post by:
Hi, all I am coding a asp.net application as user data entry and report interface. We also have another C#.net appplication (a server) does some other stuff, my webserver can send and receive...
3
by: BD | last post by:
I'm doing some cross-platform development, under LUW 8.2 (Windows) for z/OS 8. I have some fairly complex queries which address some rather large tables. One query takes approximately 30...
2
by: DavidPT | last post by:
I have setup a form that also has a subform in it. The form just shows the date and the subform holds all the other information such as Name, Task, Hours and Comments. Three of these options are...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.