Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > popup refresh in IE problem

Reply
Thread Tools

popup refresh in IE problem

 
 
Grzegorz
Guest
Posts: n/a
 
      03-31-2006
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>

 
Reply With Quote
 
 
 
 
Stephen Chalmers
Guest
Posts: n/a
 
      04-01-2006

Grzegorz wrote:
> 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);
}

--
S.C.

 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      04-01-2006
Stephen Chalmers wrote:

> 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
 
Reply With Quote
 
Grzegorz
Guest
Posts: n/a
 
      04-01-2006
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

 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      04-01-2006
Grzegorz wrote:

> 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
 
Reply With Quote
 
Randy Webb
Guest
Posts: n/a
 
      04-01-2006
Thomas 'PointedEars' Lahn said the following on 4/1/2006 7:44 AM:
> Grzegorz wrote:
>
>> 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.
>


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).

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
 
Reply With Quote
 
Grzegorz
Guest
Posts: n/a
 
      04-01-2006
Hi there,

I cannot read location property of this pop-up window - this is due to
cross-frame scripting security fix introduced in IE
(http://msdn.microsoft.com/library/de...g_security.asp)


Any ideas how to get it round?

Regards,
Grzegorz

 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      04-02-2006
Randy Webb wrote:

> Thomas 'PointedEars' Lahn said the following on 4/1/2006 7:44 AM:
>> Grzegorz wrote:
>>> 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.

>
> 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
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      04-02-2006
Grzegorz wrote:

> 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):

<URL:http://research.nihonsoft.org/javascript/ns30/ref_d-e.htm#68458>

>

(http://msdn.microsoft.com/library/de...g_security.asp)
>
>
> Any ideas how to get it round?


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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JSP: Session parameters vanish on refresh. How do I keep them on refresh? Per Magnus L?vold Java 1 10-08-2004 02:52 PM
Main > Popup > Popup > Close popup AND new URL in main? Jens Peter Hansen Javascript 7 06-19-2004 08:56 PM
How do i refresh a datagrid from a pop up window without having to refresh the whole page? Pkenty ASP .Net Web Controls 0 05-28-2004 07:06 AM
using refresh button on the menu bar to refresh two frames. Jawahar Rajan ASP General 1 10-01-2003 09:20 PM
Problem with refresh button breaking automatic refresh brian lanning ASP .Net 0 07-29-2003 07:57 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57