problem with opener.location.assign

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Venkatesh

    problem with opener.location.assign

    Hello all,

    We have a micro site that is getting opened inside a popup window from
    some external main site (the domains of our microsite and main site are
    different) ...

    I need to support the following functionality: After the user is done
    surfing the pages on our site and user clicks the close hyperlink
    (present on top of all of our webpages), the opener window's location
    needs to be reset to some given URL ....

    I had a small javascript code for this, where i have written:
    window.opener.l ocation.assign( "<url>"); .

    My problem is that this line of code is throwing an exception saying
    "Permission denied to access method location.assign " ...

    Can anybody help me and let me know why am I getting this exception?
    and how to overcome this problem?

    Thank you,
    Venkatesh

  • Richard Cornford

    #2
    Re: problem with opener.location .assign

    Venkatesh wrote:
    We have a micro site that is getting opened inside a popup window from
    some external main site (the domains of our microsite and main site are
    different) ...
    <snip>
    I had a small javascript code for this, where i have written:
    window.opener.l ocation.assign( "<url>"); .
    >
    My problem is that this line of code is throwing an exception saying
    "Permission denied to access method location.assign " ...
    >
    Can anybody help me and let me know why am I getting this exception?
    Cross domain security. You may not access the vast majority of the
    browser's object model from a script originating in a different domain.
    That includes the reading of the - loaction.assign - property implied
    in the attempt to call it.
    and how to overcome this problem?
    Generally you can access the - opener.location - property (but not its
    contents) so you could try writing the URL directly to that property
    (indeed that is the normal cross-browser method of navigating a browser
    window, and messing about with - assign - methods should never have
    even been proposed to you). I.E:-

    opener.location = '<URL>';

    Richard.

    Comment

    • Venkatesh

      #3
      Re: problem with opener.location .assign

      Hello Richard,

      Thanks for your suggestion ...

      opener.location = url works for me ...

      Actually I was of the impression that if we directly URL to
      opener.location , that would clear browser history ... But seems like
      that is not the case.

      I'm now wondering what is the exact use of the assign function?

      Thank you,
      Venkatesh

      Richard Cornford wrote:
      Venkatesh wrote:
      >
      We have a micro site that is getting opened inside a popup window from
      some external main site (the domains of our microsite and main site are
      different) ...
      <snip>
      I had a small javascript code for this, where i have written:
      window.opener.l ocation.assign( "<url>"); .

      My problem is that this line of code is throwing an exception saying
      "Permission denied to access method location.assign " ...

      Can anybody help me and let me know why am I getting this exception?
      >
      Cross domain security. You may not access the vast majority of the
      browser's object model from a script originating in a different domain.
      That includes the reading of the - loaction.assign - property implied
      in the attempt to call it.
      >
      and how to overcome this problem?
      >
      Generally you can access the - opener.location - property (but not its
      contents) so you could try writing the URL directly to that property
      (indeed that is the normal cross-browser method of navigating a browser
      window, and messing about with - assign - methods should never have
      even been proposed to you). I.E:-
      >
      opener.location = '<URL>';
      >
      Richard.

      Comment

      Working...