Leo
Leo

Reputation: 4438

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

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.)

Upvotes: 1

Views: 3709

Answers (1)

Joe
Joe

Reputation: 63

However, this one works with Chrome and Firefox:

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

Upvotes: 2

Related Questions