How do I make a web page show up only once?

后端 未结 1 1122
滥情空心
滥情空心 2021-01-06 19:43

I have made a HTML and CSS page which showcases the features of my web app. Now I want this page to load only for new visitors. If a returning visitors vists my domain, it s

相关标签:
1条回答
  • 2021-01-06 20:33

    Simple - add the following code to your landing page:

    if (localStorage.getItem("visited")) {
        window.location.href = "webPlatform.html";
    }
    localStorage.setItem("visited", "true");
    

    This checks if the localStorage variable exists - if it does, the user is redirected - if not, the variable is set.

    0 讨论(0)
提交回复
热议问题