[Koha-bugs] [Bug 28196] In page anchors on additem.pl don't always go to the right place
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Apr 26 18:31:07 CEST 2021
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28196
--- Comment #5 from Lucas Gass <lucas at bywatersolutions.com> ---
(In reply to Phil Ringnalda from comment #4)
> Since we don't support Internet Explorer, why not use the URL object, and
> let it do the work of parsing for you?
>
> Something like (untested, so I'll probably typo something)
>
> let parsedurl = new URL($(this).attr('href'));
> parsedurl.searchParams.set('searchid',me.searchid);
> window.location = parsedurl.href;
>
> Bonus advantage: if searchParams.set() sees that someone has screwed up and
> the URL already has two searchid params in it, it'll set one and delete the
> other, while doing it by hand would be adding a third.
Thanks Phil,
As far as I understand it new URL() with a single argument must include an
absolute path. You can give it a relative URL, but in that case you must always
pass the base URL as the 2nd argument.
If I'm wrong I am happy for someone to let me know of provide an alternate
patch!
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list