No category

Chrome / Chromium edit js file directly

On one of the sites I am a member of I can set my nickname for a chat window. The nickname in the chat window has a decent character limit.
In the settings for the site itself I am restricted to a maximum of 15 characters, which is an annoyance and an inconsistency.

If I try and type more than 15 characters into the field an alert box immediately pops up and the extra text is deleted. Knowing that the alert dialogue box will be generated by JavaScript I needed to find the line that did the check and amend it.

Editing the webpage in Chrome (or Chromium) can be done by right-clicking on the element (in my case the text field) and clicking “Inspect” on the popup menu.

A new window will open on the right of the webpage. At the top will be a line reading
Elements Console Sources Network
Click on “Sources”.

As there was a dialogue alert box displayed, we can do a search for the text of the message.
Press Ctrl-F (Find) and type in the alert message, in my case:
“Chat Nick Name can take a maximum”

Somewhere right above that will be the code you need to amend (at least in my case).

Find the code you need to change, change it to what you need.

Press Ctrl-S (save) to save the javascript file.

You won’t save the javascript file to the web server itself, you are only editing your local copy. The web page will now respond as if your change is part of the original web site.

tl;dr: edit the javascript in the Sources menu, press Ctrl-S and it will work.

Amazon and the Amazon logo are trademarks of, Inc, or its affiliates.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.