1

I'm trying to get info from a cross domain webpage using GM_xmlhttpRequest. It keeps on producing the following error:

XrayWrapper denied access to property onload (reason: value is callable). 
See https://developer.mozilla.org/en-US/docs/Xray_vision for more information. 
Note that only the first denied property access from a given global object will be reported.     

The code is as follows:

     // ==UserScript==
     // @include        http://stackoverflow.com/
     // @grant          GM_xmlhttpRequest
     // ==/UserScript==

function GM_test4(){

console.log("test 4");

var xhr = GM_xmlhttpRequest({

    method: "GET",
    url: "http://stackoverflow.com/",
    headers: {
        "User-Agent": "Mozilla/5.0",    
        "Accept": "text/html"            
    },
    onload : function(xhr){
        if(xhr.readyState == 4){
            if(xhr.status == 200 && xhr.responseText && xhr.responseText.length > 20){
                console.log("Inside onload");
            }
        }
    },

});

}

Jayan
  • 18,003
  • 15
  • 89
  • 143
Matthew R
  • 11
  • 3

0 Answers0