Skip to content

Instantly share code, notes, and snippets.

@stang
Forked from superstrong/gmail-permalink
Created April 17, 2019 20:42
Show Gist options
  • Save stang/195b63c6fe89b4f90d2e92c72c4c0485 to your computer and use it in GitHub Desktop.
Save stang/195b63c6fe89b4f90d2e92c72c4c0485 to your computer and use it in GitHub Desktop.
[Browser bookmarklet] To generate a permalink to a Gmail message: (1) Open the email (2) Click "Show original (3) Run bookmarklet. You can share the search query (useful for when either party is logged into more than one Gmail account) or share the browser URL. Source: http://stackoverflow.com/questions/16827485/using-gmail-message-source-genera…
@stang
Copy link
Author

stang commented Apr 17, 2019

Works as of 2019/04/17

javascript:window.open("https://mail.google.com/mail/u/0/#search/rfc822msgid%3A" + encodeURIComponent(document.getElementsByClassName('message_id')[0].innerHTML.slice(4, -4)), "_self");

@stang
Copy link
Author

stang commented Jan 29, 2022

Update - new version, working as of 2022/01/29

javascript:window.location="https://gmail.com/#search/rfc822msgid:"+encodeURIComponent(window.document.body.innerHTML.match(/Message-ID: <(.*)>/)[1])+"/"+encodeURIComponent(window.location.search.toString().slice(1).split('&').filter(function(x){return x.slice(0,10) == "permmsgid="})[0].slice(10));

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