javascriptcross-domaingreasemonkeytampermonkeygm-xmlhttprequest

Does GM_xmlhttpRequest access the website as if I am accessing the website in my browser?


I am curious as to how GM_xmlhttpRequest() reads a page in certain situations.
Does GM_xmlhttpRequest access the website as if I am accessing the website in my browser?

Do sessions remain valid? For example: If I log into a website from one browser tab and then, from another tab, I send a GM_xmlhttpRequest from my script, is this new request also logged in?

One reason I ask is because at one point in my script I am sending a GM_xmlhttpRequest to one of my domain's pages that reports back the REMOTE_ADDR from PHP. This is reporting back my computer's IP (which is what I want) instead of the page I am calling this function from.


Solution

  • OMG it totally does!!!!!!

    var server2="http://www.somesiteimloggedinto.com";
    var test_data=function(){
        GM_xmlhttpRequest({
            method: "GET",
            url: server2,
            onload: function(response) {
                if(response.status == 200){
                    alert(response.responseText);
                }
            },
            onerror: function(response) {
                console.log("Connection to "+server2+" failed.");
            }
        });
    };
    test_data();