URL.prototype.get = function(key) {
var matches = this.search.match(new RegExp(key + '=([^&]*)'))
return matches && matches[1];
}
var url = new URL('http://index.php?namefile=abc');
//var url = new URL(window.location.href);
alert(url.get('namefile'));