openseadragon / browser-extension

OpenSeadragonizer: zooming browser extension
BSD 3-Clause "New" or "Revised" License
17 stars 2 forks source link

Updating URL on click or enter #19

Closed TMUND closed 8 years ago

TMUND commented 8 years ago

Fixes #17

iangilman commented 8 years ago

Looks good to me... @avandecreme does this look good to you?

avandecreme commented 8 years ago

It seems to work but I am surprised it does. Shouldn't it be

location.href += '?img=' + urlElt.value;

(Notice += instead of =)

iangilman commented 8 years ago

I believe when you set location.href it's just the same as when you click on a link...all URLs are considered relative to the current location. That's why = works (though I imagine += would work too).

avandecreme commented 8 years ago

Alright, it is probably safer to use = then.

iangilman commented 8 years ago

I've just done some experimentation, and I think = is better. If the URL already has a query string and you do = '?foo=1', it replaces the query string. With += it actually adds the new query string to the old one.

avandecreme commented 8 years ago

Yes, that is what I thought. Merged :) Thanks @TMUND

iangilman commented 8 years ago

Excellent. I'll handle publishing it to the site.

iangilman commented 8 years ago

Deployed to http://openseadragon.github.io/openseadragonizer/ !