How can we get alart box defult value from url ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can we get alart box defult value from url ?

for example if my website/blog address is https://google.com/index.html if some one come with https://google.com/index.html+anytext how i get this ( anytext ) as my alart box value please help me .. i really thankful to you

30th Sep 2018, 9:40 PM
Sanjay Khatiwada
Sanjay Khatiwada - avatar
2 Answers
+ 4
using url object var url = new URL(window.location.href); alert( url.searchParams.get("param"));
30th Sep 2018, 9:49 PM
Toni Isotalo
Toni Isotalo - avatar
30th Sep 2018, 9:53 PM
Sanjay Khatiwada
Sanjay Khatiwada - avatar