I know it is an easy one, sorry for asking, but I’m going mad and I cannot get it. Must be the fundamentals, I’ve got them all mix up :((
I have this url:
https://www.myweb.sub.com/~user/folder/file.php?param=Value
I need to get:
https://www.myweb.sub.com/~user/folder/
in a variable.
Please help to achieve it.
Thanks a lot
You can use the
slice()andlastIndexOf()methods:If your current URL is actually
https://www.myweb.sub.com/~user/folder/file.php?param=Value, operate onwindow.location.hrefinstead.