Front end note (direct page redirection is prohibited, http-equiv="refresh" web page automatically redirects)

1. Prohibit direct page jump.js

window.onload=function(){
    
    
    //排除特定页面
    if (this.location.href.indexOf("UI/src/views/home/console.html") > 0 || this.location.href.indexOf("UI/src/views/user/login.html") > 0 ||
        this.location.href.indexOf("UI/src/views/user/forget.html") > 0 || this.location.href.indexOf("UI/src/views/user/forget.html") > 0 || this.location.href.indexOf("UI/src/views/user/reg.html") > 0
        || this.location.href.split("UI/src/views/")[1] == ""
    ) {
    
    
        return;
    }
    //禁止直接页面跳转
    //console.log(this.location.href.split("UI/src/views/")[1]=="");
    if (top.location.href == this.location.href && this.location.href.split("UI/src/views/")[0] != "") {
    
    
        location.replace("../StatePage/IllegalJumpPage.html");
        return;
    }
}


// http://192.168.1.17:8088/UI/src/views/ActivityCenter/CreateActivity.html

The effect is: open in new tab or copy the url inside to run and visit the newly created webpage, directly let it jump into IllegalJumpPage.html.

2 META http-equiv="refresh" to realize automatic web page redirection

default.htm content:

  <meta http-equiv="refresh" content="0; url=UI\src\views\user\login.html" />

The environment is as follows: create a default.htm under the IIS project folder, and put default.htm on the top of the IIS default document.

The effect is to visit: http://192.168.1.19:8063/ automatic redirect> http://192.168.1.19:8063/UI/src/views/user/login.html

Reference: https://www.cnblogs.com/lixihuan/p/6824871.html

Guess you like

Origin blog.csdn.net/Nightwish5/article/details/109331858