"Access Denied" when call window.location.href RRS feed

  • Question

  • I write a COM which can return the IHTMLDocument object with specified title.

    Inside, I get the IHTMLDocument object by travelling all windows and sending "WM_HTML_GETOBJECT" to the page window.

    In Javascript, I create this COM object by calling ActiveXObject.

    It's fine, I get the document object.

    and then I get window object from the attribute "parentWindow" of the document.

    but when I call window.location.href, An "Access Denied" exception occurs.

    why? how can I resolve this problem?

    Thanks a lot. 

    Saturday, July 30, 2011 4:50 PM

All replies

  • Hi,


    Parse the document.location.URL to extract the protocol, domain, port and path from sites that are in a lower security zone. By default scripted extensions are in the My Computer zone (hidden) which is equivalent to the Internet zone....

    As always you have to assume that users too have set their IE security zone settings to their default... (Security tab of Internet Options, click "Reset all zones to defalt"

    Monday, August 1, 2011 2:45 AM
  • When I read the attribute of the object location. An "Access Denied" exception occurs. for example:




    But when assign to this attribute, it works well. for example:

    window.document.location.href = "http://www.google.com";


    window.location.href = "http://www.google.com";

    Wednesday, August 3, 2011 7:35 AM
  • I was experiencing the same thing on our production site.

    For some reason accessing the value of document.location.href threw an exception.


    Has anyone figured it out?



    Tuesday, August 16, 2011 5:54 AM
  • Maybe, for safety.
    Monday, October 10, 2011 1:20 PM