 <p>I would not change the URL when a modal appears. A modal is an overlay of your page and actually not a new page with a new URL.</p> <p>Many image hosters, however, show the URL in a read-only field under the picture so that users can copy it. Maybe this is the way you would like to go.</p> <p>On the page itself I recommend using <code>$location</code> to determine if there is an <code>imageId</code> in your URL. If so, just invoke the same logic as if a user clicked on that image on the page.</p>