j a v a s r i p t : refresh() <- does not work :-(
Well, I just want to make a link that will initiate refresh/reload command.
Any help will be appritiated :-)
Best Regards,
| SitePoint Sponsor |

j a v a s r i p t : refresh() <- does not work :-(
Well, I just want to make a link that will initiate refresh/reload command.
Any help will be appritiated :-)
Best Regards,
window.refresh() doesn't work?
Try self.location.href=self.location.href;
^^^chunky but it will work.
it's not refresh() it's reload()
you can force a page to reload even if it hasn't been altered with:
Code:window.self.reload(true);


Hey guys,
Actually reload() is a method of the location object. So:
window.location.reload()
or:
location.reload()
aDog![]()
Moderator at www.javascriptcity.com/forums/
Thanx guys, I only realised on my way up north for the weekend the error of my advice.
refresh() for forms
reload() for window.location


Hi guys,
sorry but I'm a total javascript newbie...
what if I have a main window and a popup window. I want to have a "CLOSE WINDOW" link on the popup window, and when one clicks it, I want the main window to automatically reload.
This would be one sweet code, if it'll work...
This is what I tried, and it doesn't work:
Thanks!Code:<a href="window.location.reload()" onClick="javascript:window.close();">Close Window</a>![]()





Watcha ya talkin about djh?![]()
I think its parent.location.reload(); not window.location.reload()
Please don't PM me with questions.
Use the forums, that is what they are here for.


say what freddydoesphp?![]()
that didn't work. i think my problem is that I don't have a parent window defined. how do I do that?
thanks!


Hey,
To access the window that opened a popup, use window.opener. So:
You might have to "setTimeout" the close part to make sure the other part runs...I don't think you do, but just in case:Code:<a href="javascript:window.opener.location.reload()" onClick="window.close();">Close Window</a>
aDogCode:<a href="javascript:window.opener.location.reload()" onClick="setTimeout('window.close()',200)">Close Window</a>
P.S- when you use HREF with javascript, the browser expects a link, so put "javascript:" however, if you are using an event handler (i.e.-onclick), it expects javascript.
Moderator at www.javascriptcity.com/forums/


![]()
dude, it didn't work... I'm bummed.
I tried both bits too and nothing... I get an error on the second one.
I think the problem is that I'm not referring to the main window properly... or maybe it's because the pop-up window acutally loads a series of different pages...
Is there any javascript code that makes every browser window refresh (forcefullly!)
Thanks!


IT WORKS!!
I didn't know I had to take out the space between the java and the script.
Must be because otherwise it will be processed....
Cool!!
Thanks dog![]()
Last edited by djh; Jun 19, 2001 at 10:00.


I was starting to wonder there....![]()
aDog
P.S>-I wish this forum software didn't add that space.
Moderator at www.javascriptcity.com/forums/



If it didn't you'd be even more mad because the JavaScript executed instead of showing up on the page.
Kevin
I am using this on one of my pages:
window.opener.location.reload(true);
to force the browser to get a fresh copy from the server. Now this works fine with IE but not with NS. The documentation says that including (true) acts like the reload button.....
Any ideas?
Thanks
Guni
oh yeah - just solved it - thanks Arielladog
with timeout it's working fine
setTimeout('window.opener.location.reload(true)',200);
cheers
Guni
Last edited by Guni; Aug 28, 2001 at 17:55.
Bookmarks