Code: Select all
var request = new XMLHttpRequest();
Code: Select all
const XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1");
request = XMLHttpRequest();
Code: Select all
var request = new XMLHttpRequest();
Code: Select all
const XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1");
request = XMLHttpRequest();
Code: Select all
function myRequire( url ) {
const XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1");
var ajax = XMLHttpRequest();
ajax.open( 'GET', url, false ); // <-- the 'false' makes it synchronous
ajax.onreadystatechange = function () {
var script = ajax.response || ajax.responseText;
if (ajax.readyState === 4) {
switch( ajax.status) {
case 200:
eval.apply( window, [script] );
console.log("script loaded: ", url);
break;
default:
console.log("ERROR: script not loaded: ", url);
}
}
};
ajax.send(null);
}
Code: Select all
// Define a XMLHttpRequest object
const XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1");
var getLibrary= XMLHttpRequest();
// Create a Get Request for the script/Library
getLibrary.open('GET',"URL OF THE SCRIPT",false);
// Send the request
getLibrary.send();
// Add the response code to the current window
eval.apply(window,[getLibrary.response]);
Code: Select all
getLibrary.open('GET',"file:///home/access2vivek/Documents/Programming/iMacros/customLibrary.js",false);