Enrique Enrique - 1 year ago 83
Javascript Question

Load content into overlay and use its URL

I don't know how to explain my question in the title... :D
I made a photo gallery and want to make the images, info, etc to be shown in an overlay. Everything works nice, but I would like the URL to be changed to the image page URL. As example I could name the galleries of Pinterest.
Thx for your help or any ideas how I could go on searching!

Answer Source

I'd suggest looking into the HTML5 History API and pushState() more specifically. I can't write an implementation here, but that's the basic answer to your question – the History API will let you change the URL without reloading the page. The real challenge you'll run into is how to handle history navigation from there (using JS to attach a listener for navigation) and to receive a URL for the gallery as generated by JS and show the right image within it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download