0

I am looking for how to execute javascript code in the URL bar via xJavascript.

The standard way would be xJavascript:JAVASCRIPTCODEHERE, you would remove the "x" and it would execute the code, but that is not working.

Am I doing it wrong, or is no longer possible?

Please help!

Slaughter
  • 1
  • 2
  • Not sure what you mean by "xJavascript", I've never heard of that. Why would you type `x` only to immediately remove it afterwards? Just directly type the `javascript:…` url! Of course, [you may not copy-paste it, as browsers try to prevent self-xss](https://stackoverflow.com/questions/7698009/why-is-javascript-pseudo-protocol-stripped-from-url-bar-when-pasted). – Bergi Nov 17 '22 at 20:28

2 Answers2

0

I'm not sure what browser you are on but this is what I use:

javascript: (() => { document.title = "Hello World";})();

It also might not be working because you are running it on a new tab (which doesn't work for chrome)

0

If you are using this feature frequirently, make a bookmark with javascript:... code.

If you want to run some random JS while editing this JS, use Devtools (F12 or Ctrl+Shift+I in browser), Sources tab on top, Snippets tab on left. Snippets are persistent, editable, may run on any page.

If you want to run the same code on every page of a website, try https://chrome.google.com/webstore/detail/user-javascript-and-css/nbhcbdghjpllgmfilhnhkllmkecfmpld or Tampermonkey

Dimava
  • 7,654
  • 1
  • 9
  • 24