popup refresh in IE problem

G

Grzegorz

Hi!

my problem: I open a pop-up window and try to refresh it contents every
30 seconds.
the code below works in Firefox browser but in IE i get Permission
Denied error. any
suggestions how to make it work in IE?

Regards,
Grzegorz


<html>
<script>
var Mypopup;
var intervalHandler;


function odswiez() {
Mypopup.location.reload(true);
}


function funkcyjka () {
Mypopup = window.open('http://google.pl','okienko');
intervalHandler = setInterval("odswiez()",30000);

}


</script>

<body onload="funkcyjka()">
</body>
</html>
 
S

Stephen Chalmers

Grzegorz said:
Hi!

my problem: I open a pop-up window and try to refresh it contents every
30 seconds.
the code below works in Firefox browser but in IE i get Permission
Denied error. any
suggestions how to make it work in IE?

Regards,
Grzegorz


<html>
<script>
var Mypopup;
var intervalHandler;


function odswiez() {
Mypopup.location.reload(true);
}


function funkcyjka () {
Mypopup = window.open('http://google.pl','okienko');
intervalHandler = setInterval("odswiez()",30000);

}


</script>

You can't call a function on a diiferent domain, but you can change the
location of a window opened by your page.
Also, you must prevent further calls after the popup closes:

function odswiez()
{
if( !Mypopup.closed )
Mypopup.location='http://google.pl'; //.reload(true);
else
clearInterval(intervalHandler);
}
 
T

Thomas 'PointedEars' Lahn

Stephen said:
You can't call a function on a diiferent domain, but you can
change the location of a window opened by your page.
Also, you must prevent further calls after the popup closes:

Both statements are true.
function odswiez()
{
if( !Mypopup.closed )

if (Mypopup && !Mypopup.closed)
{
Mypopup.location='http://google.pl'; //.reload(true);

Mypopup.location = Mypopup.location;
}

should also work.
else
clearInterval(intervalHandler);
}

However, assigning to .location is _not_ equivalent to .reload(true).
First, it can append to the window history; second, the resource will
be loaded from the local cache if feasible (therefore you need cache
control headers). reload(true) does neither.


PointedEars
 
G

Grzegorz

Thanks for support. However I would like to force this popup to refresh
its current URL (user may navigate in it) - I do not want it to be hard
coded.

the solution with:

Mypopup.location = Mypopup.location;

does not working - I get exception error.

Maybe I should use vbscript ???

Regards,
Grzegorz
 
T

Thomas 'PointedEars' Lahn

Grzegorz said:
Thanks for support. However I would like to force this popup to refresh
its current URL (user may navigate in it) - I do not want it to be hard
coded.

Since ...
the solution with:

Mypopup.location = Mypopup.location;

does not working - I get exception error.

.... you are out of luck with JS.
Maybe I should use vbscript ???

If it should be IE-only, you can try. But I doubt this will help.


PointedEars
 
R

Randy Webb

Thomas 'PointedEars' Lahn said the following on 4/1/2006 7:44 AM:
Since ...


.... you are out of luck with JS.

No. You save a reference to the URL you opened in a Global scope and
then you set the location to that reference value:

var myURLVariable = "http://www.google.com";

function whatever(){
Mypopup.location = myURLVariable;
}

Then, you aren't stuck with not being able to read the URL of a window
from a different domain (which is why the location = location doesn't work).
 
T

Thomas 'PointedEars' Lahn

Randy said:
Thomas 'PointedEars' Lahn said the following on 4/1/2006 7:44 AM:
^^^^^^
Since ...


.... you are out of luck with JS.

No. You save a reference to the URL you opened in a Global scope and
then you set the location to that reference value: [...]

You missed the point.


PointedEars
 
T

Thomas 'PointedEars' Lahn

Grzegorz said:
I cannot read location property of this pop-up window - this is due to
cross-frame scripting security fix introduced in IE

This security feature is not only supported by IE, and certainly it is not
a "scripting security fix introduced in/by IE"; in fact, it originates from
Netscape 3.0 (JavaScript 1.1):


Well, you can lower IE's security level of course, but I strongly recommend
against that. You could try to add the site to the Trusted Sites list and
see what happens. Or maybe you have better luck with VBScript (viable only
in an IE-only environment), as you suggested.

You have not told enough about the environment this is supposed to run in.
Maybe if you did, that would allow for suggestions of alternative
approaches.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,838
Latest member
KandiceChi

Latest Threads

Top