且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何阻止对HTML页面的直接访问

更新时间:2023-12-01 15:53:04

您可以定义类似window.parentPage = true;的变量 在index.html文件中.

You can define a variable like window.parentPage = true; in the index.html file.

在products.html页面中进行如下检查:

In the products.html page make a check like so:

if(!window.parentPage)
{
    window.location.href = "YOUR REDIRECTION PAGE"
}