martindholmes / facsViewer

Simple HTML/CSS/JS facsimile viewer which can read server directory listings
Mozilla Public License 2.0
1 stars 0 forks source link

Option to use URL args instead of hash #5

Closed gtnewton closed 4 years ago

gtnewton commented 4 years ago

Right now when I click on an image facsViewer uses href="#ooo_cows.jpg" to get the image and my URL looks like 'https://myserver.ca/#ooo_cows.jpg'.

For a full-page app this is fine, but If I'm building an encapsulated gallery where I want the facsViewer to be physically contained the result is difficult to manage with just CSS due to the browser default that scrolls a page to the target. I can provide a crude example if this isn't clear.

I would like to have an option that produces URLs like '?img=ooo_cows.jpg' or, even more controversially, background the process entirely so that there is no change to the URL when an image is selected. I like this last option for cases where keeping the URL tidy has more value than being able to bookmark an image.

martindholmes commented 4 years ago

I specifically wanted the URL hash so that a user can bookmark or link to any specific image; most of my use-cases require that. I also like the fact that it's harvester-friendly, whereas URL params are less so. I think if I were embedding this in another page that does other stuff, I'd use an iframe. To switch from using the target to some other mechanism will be pretty drastic, I think. It's easy to provide other methods by which you can set the target, but right now they would all involve my setting the target in the URL, which means they don't solve your problem. Will an iframe not do the job?

martindholmes commented 4 years ago

@gtnewton You can now do this in the dev branch; let me know if it works for you. Section 3.5 of the tutorial shows you how.

martindholmes commented 4 years ago

@gtnewton I'm going to close this issue in favour of https://github.com/martindholmes/facsViewer/issues/6, and drop the necessity for parsing URL arguments at all if that's OK. I think the option of a constructor parameter and a location hash that can override it should be enough.