GM_xmlhttpRequest inside unsafeWindow

Posted by streetparade on Stack Overflow See other posts from Stack Overflow or by streetparade
Published on 2010-04-21T09:01:07Z Indexed on 2010/04/21 9:03 UTC
Read the original article Hit count: 162

Filed under:
|

Hy, i need the content of a web page, in greasemonkey.

i wrote a function like this.

unsafeWindow.testpage = function()
{
GM_xmlhttpRequest(
    {
       method: "GET",
       url: "http://www.test.com/xml/xml.php",
       headers: {
        "User-Agent": "Mozilla/5.0",
        "Accept": "text/xml" 
         },
       onload: function(response) 
       {

        alert(response.responseText);

       }
    });
}

If i execute the above it just logs that GM_xmlhttpRequest cannot be executed inside a unsafewindow.

How can i get the content of http://www.test.com/xml/xml.php in a unsafe window?

What i expect is that the content of http://www.test.com/xml/xml.php is returned in alert box

How can i do that?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about greasemonkey