Reputation: 345
I need to deny changing document.domain
. Say, if I run this code at foo.boo.com
Object.defineProperty(document, 'domain', {
get: function () {
return 'foo.boo.com';
}
});
and then will it be possible to set document.domain
to boo.com? I ask because I want to deny changing document.domain
by untrusted code.
Upvotes: 2
Views: 487
Reputation: 180065
The code you propose does not appear to work at all. Safari:
A demonstration of it failing to prevent modification of document.domain
in Chrome:
Upvotes: 1