I want to execute javascript file which is on another server and get the output of that script from my javascript code. Is there any way of doing this? Thanks in advance.
The file which is on another server contains document.write method. Can I get that output in my javascript variable?
Only by overriding document.write and then loading the new script.
function capture(data) {
// do something with data
}
document.write = capture;
var script = document.createElement("script");
script.src = "http://example.com/example.js";
document.body.appendChild(script);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With