Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am developing an application which gets script from server using ajax and execute it, I got success to execute that script. But my problem is I need to restart JavaScript engine to clear running JavaScript.

For Ex.

If I got this script from server.

var d = function () {
    setInterval(function () {
        console.log(new Date())
    }, 1000)
};
d();

And this script will print date for each second, now I want to load another script which print just time. How can I clear previous script from memory? I tried by deleting variable d, but it is not working, and I cant use clearInterval() as there can be any script in ajax call.

In short, I want to reset JavaScript engine of browser to initial stage so I can load new scripts.

share|improve this question
    
You can't do that without reloading the page. –  Blender 10 mins ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.