# Js-ipfs in-browser persistent pins

**URL:** <https://discuss.ipfs.tech/t/js-ipfs-in-browser-persistent-pins/5386>\
**Category:** js-ipfs\
**Tags:** js-ipfs\
**Created:** [May 11, 2019, 7:49pm UTC](https://discuss.ipfs.tech/t/js-ipfs-in-browser-persistent-pins/5386 "2019-05-11T19:49:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![npfoss](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/npfoss/32/1318_2.png) [@npfoss](https://discuss.ipfs.tech/u/npfoss)\
**Post date:** [May 11, 2019, 7:49pm UTC](https://discuss.ipfs.tech/t/js-ipfs-in-browser-persistent-pins/5386/1 "2019-05-11T19:49:49Z")

</div>

Hey, is there a way to pin a hash in the browser (presumably to localStorage) so that it persists between refreshes?

I’d like users to be able to come back to my site and have access to all the stuff they saved before even if no one else on the network has cached it.

I know this is supposed to happen already, but if I pin an example hash (and confirm success with pin.ls), disconnect from the internet, and refresh the page (localhost), I can no longer cat that hash. (No, it’s not because I’m doing a hard refresh, though that does make this fail as well.)

---

<div class="post-metadata">

**Author:** ![npfoss](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/npfoss/32/1318_2.png) [@npfoss](https://discuss.ipfs.tech/u/npfoss)\
**Post date:** [May 12, 2019, 1:34am UTC](https://discuss.ipfs.tech/t/js-ipfs-in-browser-persistent-pins/5386/2 "2019-05-12T01:34:00Z")

</div>

Never mind, I’m pretty sure this is a bug and filed an issue here: [https://github.com/ipfs/js-ipfs/issues/2045](https://github.com/ipfs/js-ipfs/issues/2045)

---

<div class="post-metadata">

**Author:** ![olizilla](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/olizilla/32/2302_2.png) [@olizilla](https://discuss.ipfs.tech/u/olizilla)\
**Post date:** [May 13, 2019, 3:38pm UTC](https://discuss.ipfs.tech/t/js-ipfs-in-browser-persistent-pins/5386/3 "2019-05-13T15:38:00Z")

</div>

Alan Shaw said:

> You’re using a different repo each time: repo: String(Math.random() + Date.now())  
> Try setting that to a static string instead and it should work.

Hope that helps
