473,385 Members | 1,676 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,385 software developers and data experts.

Refresh page onclick of button

Hi,
I m using javascript in HTML Page.And i want to refresh the page onclick of a button.I Tried with history.go(0) ;
Its working fine but wil it cause any caching? I want to know some better way of refreshing ,because my html page is behaving very differently.

Thanks
daitasri
Mar 7 '08 #1
8 5573
gits
5,390 Expert Mod 4TB
use a function like this:

Expand|Select|Wrap|Line Numbers
  1. function refresh_page() {
  2.     window.location.href = window.location.href + '?' + (+ new Date);
  3. }
the last section that we add avoids the caching through adding a timestamp to the request ...

kind regards
Mar 7 '08 #2
acoder
16,027 Expert Mod 8TB
Does location.reload() not work?
Mar 7 '08 #3
dlite922
1,584 Expert 1GB
Does location.reload() not work?
that should work, but i don't remember how cross-browser compatible it is. I'd check it out first.
Mar 7 '08 #4
gits
5,390 Expert Mod 4TB
:) reload(true) should have the same effect - without the param it calls the page from the cache i think? ... and i think it should work with all browsers ...

kind regards
Mar 7 '08 #5
acoder
16,027 Expert Mod 8TB
Yes, the forceGet parameter forces a reload from the server. If it's not specified, it could possibly be loaded from the cache.
Mar 7 '08 #6
Hi
Thank you very much for your valuable help. It is working. Now i dont have any caching problem. :)

Thanks
diatasri
Mar 14 '08 #7
acoder
16,027 Expert Mod 8TB
Glad you got it working! Which solution did you use in the end?
Mar 14 '08 #8
Glad you got it working! Which solution did you use in the end?
I used the following code :
Expand|Select|Wrap|Line Numbers
  1. function refresh_page() {
  2.     window.location.href = window.location.href + '?' + (+ new Date);
  3. }

Thanks
daitasri
Mar 17 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Andrus Moor | last post by:
I want to add a refresh button to my web page which works like browser refresh button: it must re-load current page from server. How to implement this in javascript ?
9
by: PK9 | last post by:
I'm having an issue with the "Refresh" of an asp.net page. The refresh is actually calling my last onClick event. I thought that asp.net was supposed to be stateless in that it shouldn't...
5
by: Peter | last post by:
1) I have a C# web application and what I am trying to do is create a popup window from a link on the parent window 2) the popup window will have a button and when a user clicks on the button the...
3
by: Sameer | last post by:
I have a webpage that has a link button. This link button on click opens up a new page. This is what is happening: 1. Load the web page. 2. Click on the link. 3. Refresh the web-page. Result:...
7
by: Brian | last post by:
hello, I am looking for a way to auto refresh a web page that I created, but also let the user choose to stop the auto refresh. I can not figure out how to stop the auto refresh. Any help would...
0
by: nuhura01 | last post by:
Hi.. I'm creating a new html page using the code below in order to preview and print data: Dim oStringWriter As System.IO.StringWriter = New System.IO.StringWriter Dim oHtmlTextWriter As...
1
by: getmathan | last post by:
I have the below script which ll display a box to accept url and time. I need to add some code to it so that it should open the accepted url in a popup and display it every n seconds given as input....
4
by: Perl Beginner | last post by:
I have created a GUI window using Perl Win32::XMLBuilder. This window has several buttons on it, that when a button is clicked another Perl script will execute. When the script is complete, the GUI...
1
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category...
2
by: qwedster | last post by:
Folks! The following is a "Hello World" kind of code for ViewState. I just want to know how to retain the ViewState 1) while Page Refresh when using UpdatePanel and also 2) While I reverting back...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.