【发布时间】:2017-07-13 23:14:25
【问题描述】:
【问题讨论】:
-
只是
console.log(window.location)
标签: angularjs
【问题讨论】:
console.log(window.location)
标签: angularjs
你知道参数的名称吗?那你就可以这样做了
http://www.angulartutorial.net/2015/04/get-url-parameter-using-angular-js.html
您要解码的 url,是当前访问的站点还是用户在某个文本框中写入的 url?
那么这将是您的解决方案:https://stackoverflow.com/a/2880929/6629704 请注意查询 - 变量不应由 window.location 填充,而是由输入值填充
【讨论】:
// 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
【讨论】: