-
3
-
15
-
18.07.2013
-
Spain
Hi everyone,
I would like to put an age verification web before the landing page, but I don´t know how.
Can anyone help me?
Thank you very much.
-
976
-
11658
-
30.11.2012
-
Angola
Hi,
try to use the following script (put it to the _Root.cshtml):
<script type="text/javascript">
var Cookie = new Object();
Cookie.set = function(name, value, expires, path, domain, secure) {
document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
};
Cookie.get = function(name) {
var prefix = name + "=";
var cookieStartIndex = document.cookie.indexOf(prefix);
if (cookieStartIndex == -1) return null;
var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length;
return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
};
Cookie.del = function(name, path, domain) {
if (getCookie(name)) {
document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
};
var cookieExists = null;
cookieExists = Cookie.get("myStore");
if (cookieExists != "1")
{
var areYouReady = confirm("You are 18 years old?");
if (areYouReady) {
Cookie.set("myStore", "1");
}
else { location.href = "javascript:history.back()"; }
}
</script>
-
3
-
15
-
18.07.2013
-
Spain
Hi Mariann,
I didn't realize you answered, so I will try your code this week and I will let you know if it worked correctly.
Thanks a lot for your help.
-
3
-
15
-
18.07.2013
-
Spain
Hi again,
I have already tried it out and it works perfect!!!
Thanks a lot for your help.
-
26
-
168
-
08.04.2012
-
United States
Used this in 4.10. Works great thanks for Javascript.
<script type="text/javascript">
var Cookie = new Object();
Cookie.set = function(name, value, expires, path, domain, secure) {
document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
};
Cookie.get = function(name) {
var prefix = name + "=";
var cookieStartIndex = document.cookie.indexOf(prefix);
if (cookieStartIndex == -1) return null;
var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length;
return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
};
Cookie.del = function(name, path, domain) {
if (getCookie(name)) {
document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
};
var cookieExists = null;
cookieExists = Cookie.get("myStore");
if (cookieExists != "1")
{
var areYouReady = confirm("You are 18 years old?");
if (areYouReady) {
Cookie.set("myStore", "1");
}
else { location.href = "javascript:history.back()"; }
}
</script>[/quote]
-
28
-
160
-
21.04.2009
-
United States
This works,
but could this be done in a nice pop up, that could have some disclaimer and some information