java - edit url parameter of a page and show editing as a hyperlink in same page

408 Views Asked by At

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

1

There are 1 best solutions below

0
On

you cant try javascript regular expressions

var url = window.location.href;
var parts = url.match(/id=(\w+)/);
console.log(parts[1]);