DelphiFAQ Home Search:

Reload a web page with a javascript function

 

comments17 comments. Current rating: 5 stars (4 votes). Leave comments and/ or rate it.

Question:

I need to force a page reload from a javascript function but document.reload() seems not to work. How do I do it?

Answer:

The document object is not used to reload a window, that is the reason for your problem. Below are three examples, in these cases in the onclick event.

This code will reload the current window. If it is shown in a frame, then only this frame will be reloaded. If you need to reload another frame, then you may want to address it as shown in the last 2 examples.

<input type="button" value="Reload Page" onClick="window.location.reload()">

<input type="button" value="Reload Page" onClick="history.go(0)">

<input type="button" value="Reload Page" onClick="window.location.href=window.location.href">

<input type="button" value="Reload 1st Frame" onClick="window.parent.frames[0].location.reload();">

<input type="button" value="Reload 2nd Frame" onClick="window.parent.frames[1].location.reload();">

Comments:

You are on page 2 of 2, other pages: 1 [2]
2017-05-19, 16:38:01
Seymour from Taiwan  
rating
Have you ever considered writing an ebook or guest authoring on other blogs?
I have a blog based upon on the same subjects you
discuss and would love to have you share some stories/information. I know my
subscribers would enjoy your work. If you're even remotely interested,
feel free to send me an e-mail.
2017-05-19, 23:27:04
anonymous from Los Angeles, United States  
I never believed in this blank ATM card until i got one for my self, i was going through a friends pics on twitter when i saw a comment about a blank ATM card that can make you rich. I decided to give it a try by purchasing one of the card, though i was curious but my curiosity was satisfied when i got the blank card and made a withdrawal of $5000 instant & was also able to transfer $8000 into my bank account. I never believed this card was real after i lost money to scammers but this hackers proved me wrong that they were real and possesses the card, don't be left out at this great opportunity has i have detected the real hackers. To get this card without getting scammed then Email: ghosthackingfoundation.hk@gmail.com
You are on page 2 of 2, other pages: 1 [2]

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: