Skip to content

Instantly share code, notes, and snippets.

@kentbrew
Last active May 3, 2023 08:44
Embed
What would you like to do?
How to recreate your long-lost Pinterest bookmarklet.

How to recreate your long-lost Pinterest bookmarklet.

Right-click your bookmarks bar and choose Add Page (Chrome) or New Bookmarklet (Firefox).

In Name, put this:

Pin It

In URL, put this:

javascript:void((function(d){d.addEventListener('securitypolicyviolation',function(r){alert('ContentSecurityPolicyError!');});e=d.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('debug','true');e.setAttribute('src','//assets.pinterest.com/js/pinmarklet.js?r='+(Math.random()*99999999));d.body.appendChild(e);}(document)));

For My Little Friend Safari:

  • open about:blank in a new window (this will help you not have to mess around with favicons later)
  • hit command-D
  • choose Favorites under Add this page to:
  • enter Pin It in the Name box
  • right-click the Pin It bookmarklet you just made and choose Edit Address
  • paste in the JavaScript from above

If You're Running Chrome or Firefox, Pinmarklet will Bother You to Install the Pinterest Browser Extension

  • From time to time you'll see a big banner in the image grid, begging you to please install the extension.
  • If you don't want to install the extension, click the "no, thanks" button to set a two-week cookie.

Why you Might Want the Extension After All

  • Pinning with the extension is much better, especially if you pin a lot. You'll have free hovering Save buttons (which you can turn off in Settings) and you can right-click and pin an image without the intervening wait-for-the-grid / pick-an-image cycle.
  • Pinning happens right there inline instead of in a pop-up window.
  • You also get Visual Search for free. Right-click the body of the page to search a full screenshot, or choose the hovering selector button to search an individual image.
@felixfischer
Copy link

👍 Thanks!

@CoolCanuck
Copy link

Thanks very much!

@asyapluggedin
Copy link

no favicon for chrome?

@kentbrew
Copy link
Author

Seriously: you really, really want the new Chrome extension. Visual search! Inline pinning! Go, download, enjoy: https://chrome.google.com/webstore/detail/pinterest-save-button/gpdjojdkbbmdfjfahjcgigfpmkopogic

@kentbrew
Copy link
Author

Just updated with a thing that will warn you if you're trying to execute on a page with a content security policy forbidding outside resources, such as GitHub.

@kentbrew
Copy link
Author

Here's a handy link showing how to set up a bookmarklet on an IOS device. Same approach will work for pinmarklet: https://paprikaapp.zendesk.com/hc/en-us/articles/114094153074-How-do-I-set-up-the-bookmarklet-on-my-iPad-

@kentbrew
Copy link
Author

Fixed up the URL. /max/ won't let those config params actually work, sorry!

@jessicandavis
Copy link

As of Aug 19, 2019, still working in Brave/Chromium--thanks! I don't see any advantages of the extension over the bookmarklet, either, except that I'm not able to get rid of the nag screen (see attached, from here). Can still opt for "no thanks," but it shows up every time I try to pin something new.

Is there a specific cookie or something I should block? Anything that can be done?
Annotation 2019-08-19 173035

@kentbrew
Copy link
Author

kentbrew commented Sep 16, 2019

Pinterest is trying to set a seven-day cookie named bxn when you click that button but Brave is blocking it, since it's being set inside an iframe and (I am guessing) looks just like a cross-site cookie. When I change Brave's default settings to allow all cookies it works, but I will guess you don't want to do that.

If I could tell it was Brave by the user agent string I could probably fix this, but it's pretty generic: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.75 Safari/537.36. Suggestions welcome!

[Edit: oh, maaan. I'd only used Brave on my mobile before ... it is SO SWEET on desktop!]

@krutovskaya
Copy link

Hi! I have a problem with installing such a command in Safari. How do I actually use it? When I'm selecting that from the bookmark bar, H get a following answer:
Снимок экрана 2020-08-05 в 10 52 42

Help!

@gnumoksha
Copy link

Thank you. It worked on Firefox 81.0, but there is something making the browser freezing.

@pixelinpink
Copy link

Does not work on Safari 14.1

@skin-soc
Copy link

This no longer works.

ContentSecuritPolicyError!

@marceloangelim
Copy link

Worked! Thanks man!

@kentbrew
Copy link
Author

@kentbrew
Copy link
Author

For those seeing the ContentSecurityPolicy error, that's probably happening because you're running pinmarklet on GitHub, which forbids external JavaScript embeds.

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