我正在尝试获取此完整网址: https://mail.google.com/mail/u/0/?ui=2#inbox/13047asdee8be4e1
通过使用:
var url = document.location.toString();
但它最多只返回 https://mail.google.com/mail/u/0/?ui=2
我也尝试过其他方法,如 document.url、window.location,但它仍然吐出同样的东西。
最佳答案
var url = document.location.toString() + '#' + window.location.hash;
document.location.href
似乎也能正常工作,并在我的测试中返回了整个地址栏。
关于php - URL 的 Jquery/Javascript 检索不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6256946/