popup refresh in IE problem

Discussion in 'Javascript' started by Grzegorz, Mar 31, 2006.

  1. Grzegorz

    Grzegorz Guest

    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>
     
    Grzegorz, Mar 31, 2006
    #1
    1. Advertising

  2. 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.
     
    Stephen Chalmers, Apr 1, 2006
    #2
    1. Advertising

  3. 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
     
    Thomas 'PointedEars' Lahn, Apr 1, 2006
    #3
  4. Grzegorz

    Grzegorz Guest

    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
     
    Grzegorz, Apr 1, 2006
    #4
  5. 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
     
    Thomas 'PointedEars' Lahn, Apr 1, 2006
    #5
  6. Grzegorz

    Randy Webb Guest

    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/
     
    Randy Webb, Apr 1, 2006
    #6
  7. Grzegorz

    Grzegorz Guest

    Grzegorz, Apr 2, 2006
    #7
  8. 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
     
    Thomas 'PointedEars' Lahn, Apr 2, 2006
    #8
  9. 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/default.asp?url=/workshop/author/om/xframe_scripting_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
     
    Thomas 'PointedEars' Lahn, Apr 2, 2006
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. brian lanning
    Replies:
    0
    Views:
    611
    brian lanning
    Jul 29, 2003
  2. Per Magnus L?vold
    Replies:
    1
    Views:
    5,163
    John C. Bollinger
    Oct 8, 2004
  3. Pkenty
    Replies:
    0
    Views:
    412
    Pkenty
    May 28, 2004
  4. Jawahar Rajan
    Replies:
    1
    Views:
    302
    Adrienne
    Oct 1, 2003
  5. Jens Peter Hansen
    Replies:
    7
    Views:
    560
    Randy Webb
    Jun 19, 2004
Loading...

Share This Page