Using Google Chrome to debug and edit javascript embedded in HTML page

前端 未结 5 1332
终归单人心
终归单人心 2021-01-31 07:00

Chrome developer tools allows you to edit javascript in the browser if the javascript is in a .js file. However, it does not seem to allow me to edit javascript that is embedded

5条回答
  •  灰色年华
    2021-01-31 07:33

    Solution described here: https://greatrexpectations.com/2014/01/22/chrome-dev-tools-inline-dynamic-javascript

    Add the 'sourceURL' directive in your inline/embedded script like this:

    
    

    Then this script will appear in the page Sources and you can debug and edit it similarly to js loaded from a URL source

提交回复
热议问题