年龄验证:检查Cookie

时间:2018-11-05 21:21:39

标签: cookies verification

我正在为我的网络漫画网站。它包含成熟的内容,因此我希望有一个初始页面,可以在进入网站之前验证用户的年龄。

这是我的temporary host(很多东西都还没有完成。)我遇到的问题是,对Cookie的检查仅在某些浏览器上有效-否则,每次单击某些内容时它都会显示启动页面。我将如何解决这个问题?

JavaScript:

<script language="javascript">
$(function() {

   //Check it the user has been accpeted the agreement
if (!(document.cookie && document.cookie == "accepted")) {
$("#popup").show();
}

$('[data-popup-close]').on('click', function(e) {
var targeted_popup_class = jQuery(this).attr('data-popup-close');
$('[data-popup="' + targeted_popup_class + '"]').fadeOut(350);

//Set a cookie to remember the state
document.cookie = "accepted";

e.preventDefault();
});

});

0 个答案:

没有答案
相关问题