[Greasemonkey] XMLHttpRequest and document.domain

Saravanan saravanannkl at gmail.com
Sun Jul 24 12:23:01 EDT 2005


Hi,
I am working on a Greasemonkey script that uses XMLHttpRequest. This
script acts on the url pattern "http://timesofindia.indiatimes.com/*".
When the GM script tries to connect to url
"http://timesofindia.indiatimes.com/" then mozilla throws an exception
"Permission denied to call method XMLHttpRequest.open". But the GM
script is able to connect sucessfully to the url
"http://indiatimes.com/".

After digging out I found that the document.domain value is changed
from "timesofindia.indiatimes.com" to "indiatimes.com" in the page
thru javascript. I thought this may be reason for XMLHttpRequest not
working in my script. so I tried to change the value of
document.domain back to "timesofindia.indiatimes.com" in the script.
mozilla throws  exception when the script tries to change the value of
document.domain.

Is my assumption correct or am I missing something. can somebody throw
some light on XMLHttpRequest security and how it is handled in mozilla
browsers.

I am attaching my GM script for reference
-------------- next part --------------
A non-text attachment was scrubbed...
Name: timespagingremover.user.js
Type: application/x-javascript
Size: 987 bytes
Desc: not available
Url : http://mozdev.org/pipermail/greasemonkey/attachments/20050724/be115b3c/timespagingremover.user.js


More information about the Greasemonkey mailing list