How to open email by x-gm-msgid in Gmail with Javascript
Posted
by
Rui J
on Stack Overflow
See other posts from Stack Overflow
or by Rui J
Published on 2012-04-12T17:24:53Z
Indexed on
2012/04/12
17:29 UTC
Read the original article
Hit count: 289
I'm writing an extension which surfaces links to gmail messages. As the UI loads right in Gmail, I should be able to click on one of these links and have Gmail load it (without refreshing). I have "x-gm-msgid" available and theoretically, I should just be able to navigate to "https://mail.google.com/mail/u/0/#inbox/[x-gm-msgid]".
I've tried using
location.hash = "#inbox/[x-gm-msgid]"
I've tried using
history.pushState(null, null, "/mail/u/0/#inbox/[x-gm-msgid]")
Neither of which works. Gmail just thwarts any attempt to change the URL (unless it is done via user interaction)
Any thoughts on how to get around this restriction?
© Stack Overflow or respective owner