答案 0 :(得分:2)
您知道参数的名称吗?然后你可以这样做
http://www.angulartutorial.net/2015/04/get-url-parameter-using-angular-js.html
您要解码的网址,是当前访问过的网站还是用户在某个文本框中编写的网址?
然后这将是您的解决方案:https://stackoverflow.com/a/2880929/6629704 请注意,查询变量不应由window.location填充,而应由输入值
填充答案 1 :(得分:0)
// Prints complete URL
document.write(window.location.href);
// Prints protocol like http: or https:
document.write(window.location.protocol);
// Prints hostname with port like localhost or localhost:3000
document.write(window.location.host);
// Prints hostname like localhost or www.example.com
document.write(window.location.hostname);
// Prints port number like 3000
document.write(window.location.port);
// Prints pathname like /products/search.php
document.write(window.location.pathname);
// Prints query string like ?q=ipad
document.write(window.location.search);
// Prints fragment identifier like #featured
document.write(window.location.hash);
来源:https://www.tutorialrepublic.com/javascript-tutorial/javascript-window-location.php