Changing JS Code in Inspect Element Editor

When I make some changes to the html content using the Chrome Inspect Element editor, the changes are reflected immediately. But when I make changes to the Javascript code, the changes are not reflected.

Suppose when I click the button I say "John is a good boy" and when I change it to "John is a bad boy" using the Inspect element (JS code) then the changes are not reflected when the button is clicked and the old text appears " John is a good boy. "

So when the page loads, it is impossible to edit the JS code and see the changes? Why is this so?

+3


source to share


2 answers


In my experience, the changes I made to the Javascript files were immediately reflected. However, an easy fix you can try is as follows:

  • Insert a breakpoint at the line you want to edit
  • Reload the page (breakpoints will persist)
  • Edit this line when hitting a breakpoint
  • Click Continue in the debugger


If you need more information on breakpoints and the debugger check this link

If you want more information on using the inspector tool, try searching for this tutorial

+1


source


It is considered a malicious practice to modify the JavaScript of a page through a browser. Imagine someone removes all logic from your login method and then has it return true;

.

Malicious users can exploit your system by making targeted changes to your system. Therefore browsers do not allow you to make these changes to life.



If you really want to, I think you could download all the source files, make your changes, and then load the browser. The project should save your changes. Though the webmaster probably has a mechanism to prevent any incoming requests to his server from Cross Origin (XSS). Recognizing that the edited requests do not come from the correct origin, the server should reject and potentially try to log / track the malicious attempt.

+1


source







All Articles