0

This is a mystery to me. The "Press This" bookmarklet works well for me, everywhere except when I try to press one of my GitHub repositories.

It doesn't just fail to grab anything, the window fails to open altogether.

Does anyone else experience this? Is this a known / documented bug? Is there an explanation?

1 Answer 1

3

This is due to the Content Security Policy (CSP) that Github rolled out in April 2013. CSP shouldn't cause problems with bookmarklets, but it does in practice.

The issue isn't specific to PressThis either. It causes problems with bookmarklets from Pinboard, Pocket and Instapaper.

In Chrome you can hit F12 to open the developer tools and see the error:

Error message in the Chrome developer tools console after attempting to use the Pocket bookmarklet on a Github page

2
  • Thanks for the answer. But grrrr! Is there any way around this, or do we just have to not press when we update our repos on GitHub?
    – interstar
    May 25, 2016 at 0:08
  • 1
    There are workarounds, but none are ideal. You can disable CSP in your browser, or rewrite the bookmarklet to have all the code instead of loading a remote script.
    – Dan H
    May 25, 2016 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.