将上一个URL传递到Javascript函数
我基本上希望做的是有一个书签链接,当单击它时,它会对当前(或实际上是上一个)URL执行操作。我已经看到Youtube转换器等实现了这一点 我已尝试使用document.referer访问上一个URL,但无效将上一个URL传递到Javascript函数,javascript,jquery,browser-history,Javascript,Jquery,Browser History,我基本上希望做的是有一个书签链接,当单击它时,它会对当前(或实际上是上一个)URL执行操作。我已经看到Youtube转换器等实现了这一点 我已尝试使用document.referer访问上一个URL,但无效 $(document).ready(function() { if(document.referrer.indexOf(window.location.hostname) != -1){ $referURL = document.referrer; console.
$(document).ready(function() {
if(document.referrer.indexOf(window.location.hostname) != -1){
$referURL = document.referrer;
console.log($referURL);
}
});
什么不起作用?我刚才给你看的代码