-2

I was trying to make a site just like https://null-24.com/download/?link="Your site"

if i enter https://null-24.com/download/?link=https://www.instandroid.net then the download button will take me https://www.instandroid.net/ when i click.

Download button How can i write the function for this?

  • Welcome. The thing you are trying to do is getting the **query string** I guess. If I got you true, there are a bunch of solutions [here](https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript) – vahdet Feb 20 '18 at 12:50

1 Answers1

1
    $.urlParam = function(name){
        var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
        if (results==null){
           return null;
        }
        else{
           return decodeURI(results[1]) || 0;
        }
    }

example.com?param1=name&param2=&id=6

$.urlParam('param1'); // name
$.urlParam('id');        // 6
$.urlParam('param2');   // null