Is pasting "javascript:alert('hi')" in the address bar blocked?

2.7k Views Asked by At

You can type this into the address bar in Google Chrome and it works:

javascript:alert('hi');

However if you try to paste the same string into the adress bar you just get this:

alert('hi');

Is that by design? Or? Standards? Security?

(I am trying to find an easier way to use bookmarklets on mobile phones. Needed for a PWA.)

1

There are 1 best solutions below

0
Joe On

However, this one works with Chrome and Firefox:

data:text/html,<script>alert('hi');</script>