Connecting Tech Pros Worldwide Forums | Help | Site Map

Permission denied error on getting window.location.href property

Newbie
 
Join Date: Jan 2007
Posts: 3
#1: Jul 10 '09
Permission denied exception is fired in IE6 on line(9) during the following
actions .

Expand|Select|Wrap|Line Numbers
  1. (1)<html>
  2. (2)<head>
  3. (3)    <title>Simple :: documentDomain :: Cars</title>
  4. (4)</head>
  5. (5)<body>
  6. (6)    <script>
  7. (7)        var fake = window.location;
  8. (8)        document.domain = "localhost";
  9. (9)        var href = window.location.href;
  10. (10)    </script>
  11. (11)</body>
  12. (12)</html>
Note:
Page is accessed on localhost.

a. If line (7) or (8) is omitted, no exception occurs.
b. If page is hosted on production with document domain name equal to
something.com, all works well.
c. In IE7 all is working fine.

Is it IE6 bug?
Is it possible to prevent exception for accessing all window.location.href properties after document.domain was set?

acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Jul 10 '09

re: Permission denied error on getting window.location.href property


Possibly a bug. However, there's no need for document.domain here. See Same_origin_policy_for_JavaScript.
Reply


Similar JavaScript / Ajax / DHTML bytes