Can I modify Javascript code in Internet Explorer 11's debugger?

29,848

Solution 1

If the JS code is embed into the HTML it should work without any problems but if it's stored I an other file you probably can't edit it in the browser. I recommend using Firefox or chrome. Both have got an inbuilt and very useful editors which can edit HTML as well as Js and CSS .

Solution 2

I know this is an older post but this might help someone else.

"I just loaded up my website in Chrome and whilst I can edit the Javascript file (you can definitely edit Javascript when it is in a .html page) but I cannot get the changes I have made in the .js file to actually function."

If you set a breakpoint at the top of the .js file and refresh, you can edit the code that comes after the break point and chrome will load your new changes. Note that your changes will be wiped out after every refresh, but it will hit your breakpoint and allow you to add them again.

Share:
29,848
John 'Mark' Smith
Author by

John 'Mark' Smith

I have come to ask questions.

Updated on June 12, 2020

Comments

  • John 'Mark' Smith
    John 'Mark' Smith almost 4 years

    In IE11 I can right click on a webpage and call the "Inspect Element" tool. This allows me to modify HTML/CSS dynamically and is extremely useful.

    enter image description here

    I can choose "Edit as HTML" and do whatever I want without having to reload the page.

    enter image description here

    What I want is to be able to do the same in IE 11's Javascript debugger. I want to modify a script in the browser so that I do not have to reload the page entirely. The page I am working on takes 20-40seconds to load when I run it locally, meaning it takes about a minute to implement even the smallest changes in my file.js.

    Can this be done?

  • John 'Mark' Smith
    John 'Mark' Smith about 9 years
    Thanks for the response. I just loaded up my website in Chrome and whilst I can edit the Javascript file (you can definitely edit Javascript when it is in a .html page) but I cannot get the changes I have made in the .js file to actually function. So if I add a basic $("#test").on("click",function(){}); and then click #test the event does not fire.
  • Shea
    Shea almost 7 years
    This is accurate but you missed one important step. After you've edited the code following the breakpoint, you'll need to save it before continuing the execution. See "Step 6: Apply a fix > Step 2".