2

So if I want to make a change, for example in this page (stackoverflow.com), using:

javascript:document.getElementById("hlogo").innerHTML = "10";

The page goes blank, only showing the string "10", even though the source code is still there.

Yet if I do this in an HTML document internally via the JavaScript console it doesn't remove the rest of the content visually.

A. Andres
  • 489
  • 4
  • 10

1 Answers1

4

Append a void(0) or any expression returning an undefined value:

javascript:document.getElementById("hlogo").innerHTML = "10";void(0);

This answer explains this behavior well: https://stackoverflow.com/a/1291950/689788

Community
  • 1
  • 1
A. Andres
  • 489
  • 4
  • 10