-
simple refresh
i have this code
Code:
<script language="JavaScript" type="text/JavaScript">
function RefreshMainWindow() {
window.opener.location.reload();
window.close()
}
</script>
//called by
<META HTTP-EQUIV="refresh" CONTENT="5; RefreshMainWindow();">
am i not allowed to call a method in a refresh block? how can i do something like this..
when the script runs, every 5 seconds, the parent refreshs, but the child windows (that this script is on) doesn't clse like it's supposed to, it refreshes too.. :(
--770
-
when you open the window open it with a var name...
Code:
var newWin = window.open('page2.htm');
... the try doing newWin.close() instead.
-
Yes you can't use scripting in a meta refresh, I think you're looking for setTimeout():
Code:
<script type="text/javascript"><!--
window.setTimeout('RefreshMainWindow();', 5000);
//--></script>
Think that should work.
-
i'm new to JS, so not exactly sure where to put the script Rick Bull gave, and how to call it....
or how to give the opening window a variable name...
this is how i'm currently opening a new window
--770
-
You can put the code I gave either in the <head> section or the <body> section. I'd go with the head.
target="_blank" is find if you're just using standard links (which is better as not every browser supports JS). Other wise you can use javascript something like
Code:
var newWin = window.open('page.html', 'windowName');
Then you can use newWin with Javascript (e.g. newWin.close()) and target the new window with standard links like <a href="#" target="windowName">