How to get previous page url using jquery

前端 未结 9 1243
独厮守ぢ
独厮守ぢ 2020-12-02 18:40

How to get the previous page url using jquery?

I am using the following code to get the current page location

$(document).ready(function() {
var path         


        
相关标签:
9条回答
  • 2020-12-02 19:05

    simple & sweet

    window.location = document.referrer;
    
    0 讨论(0)
  • 2020-12-02 19:07
        $(document).ready(function() {
                   var referrer =  document.referrer;
    
                   if(referrer.equals("Setting.jsp")){                     
                       function goBack() {  
                            window.history.go();                            
                        }
                   }  
                       if(referrer.equals("http://localhost:8080/Ads/Terms.jsp")){                     
                            window.history.forward();
                            function noBack() {
                            window.history.forward(); 
                        }
                       }
        }); 
    

    using this you can avoid load previous page load

    0 讨论(0)
  • 2020-12-02 19:08

    document.referrer is not working always.

    You can use:

    window.location.origin
    
    0 讨论(0)
提交回复
热议问题