By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,949 Members | 714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,949 IT Pros & Developers. It's quick & easy.

Permission denied error on getting window.location.href property

P: 3
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>
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, 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?
Jul 10 '09 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 16,027
Possibly a bug. However, there's no need for document.domain here. See Same_origin_policy_for_JavaScript.
Jul 10 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.