Skip to content

Instantly share code, notes, and snippets.

@cazepeda-zz
Created October 28, 2012 02:02
Show Gist options
  • Save cazepeda-zz/3967172 to your computer and use it in GitHub Desktop.
Save cazepeda-zz/3967172 to your computer and use it in GitHub Desktop.
Bookmarklet to append a string to the end of a URL
window.location.href
====================
Bookmarklet to append a string to the end of the URL.
1. Create bookmark.
2. Edit bookmark URL(Chrome) / Location(Firefox) to include this code: javascript:window.location.href=window.location.href+'REPLACETHIS';
3. Now make use of that bookmarklet.
Code: javascript:window.location.href=window.location.href+'REPLACETHIS';
@iFUCKINGHATEcomputers
Copy link

How do I make a bookmarklet which adds "about:reader?url=" to the beginning of the URL?

@minig0d
Copy link

minig0d commented Jun 29, 2023

How do I make a bookmarklet which adds "about:reader?url=" to the beginning of the URL?

Honestly, I don't think you can from a bookmarklet in modern Chrome due to the security settings. If you try to it redirects you to an about:block page.

Even from the DevTools console if you try the following it's blocked. I certainly don't want to say that it can't be done by somehow loosening security settings, via some JS glitch, or via an extension, but in terms of a traditional bookmarklet that will work for most people, I don't think it's possible. It isn't allowed in modern Firefox either.

location.href = 'about:reader?url=https://www.google.com'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment