Answer the question
In order to leave comments, you need to log in
How to make window.location.href and url.searchparam.get work on IE10+?
Hello!
Faced with the situation of ensuring the performance of a simple JS code on IE version 9 and higher.
There is an email that forms a link to a third-party page in the format site.rf/section/index.php?znum=IR1234567&surv=cr101, where znum and surv are variables processed on the final page using zurl.searchParams.get("znum" ) and further fitting into via _znum.value.
On chrome, ff and even edge - it works. On IE - stupidly does not fit anything.
Please help with alternative ways to implement this code under IE. Thank you!
Code below.
var zurl = new URL(location.href);
var _znum = zurl.searchParams.get("znum");
zid.value= _znum;
<input id="zid" type="text">
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question