0

i need java code to get a part from URL when reload a page and put it in hyperlink and show it in same page.

Example

get google drive file id from page url while reload:

http//example.com#https//drive.google.com/open?id=fileid

.

and add it to this hyperlink with new parameter:

http//docs.google.com/uc?id=fileid&export=download

Ammar
  • 1
  • Possible duplicate of [How can I get query string values in JavaScript?](https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript) – nikos fotiadis Nov 25 '18 at 10:25

1 Answers1

0

you cant try javascript regular expressions

var url = window.location.href;
var parts = url.match(/id=(\w+)/);
console.log(parts[1]);
suresh bambhaniya
  • 1,687
  • 1
  • 10
  • 20