+ 18
How to restrict entry in a website ??
Suppose, I have developed a website which is not suitable for children below 12 years. How can I display a pop-up asking them to confirm that they are not below 12 years ? The pop-up should have 2 options: One of confirm and other to go back. Edit : If the user clicks back, he should be redirected to the page from where he came to the website.
19 odpowiedzi
+ 13
var user=confirm ("Are you above 12");
if (user == true){
alert("Welcome to our site!")
}else{
window.location.href ="https://www.sololearn.com";
}
here it is
+ 9
@shudarshan thanks for the help, bro !!
+ 8
var user=confirm ("Are you above 12");
if (user == true){
alert("Welcome to our site!")
}else{
alert("You are below 12,Please Read our Terms and policy")
}
but its not enough you can make a another page load when you get false reply ,page can be of term and policy
+ 7
you can use confirm() but to continue to the page i dont know
+ 7
@blizz i had tried confirm but if user choose cancel then also the html part executes.
+ 7
@Sudarshan How can I load T&C page??
+ 7
ok
+ 7
@jan I just want to display a pop-up box. You will find many such age restricted website. They do not need ID proofs.
+ 6
@Sudarshan For ex, someone has opened this website through a link on www.sololearn.com. Is it possible to acheive that when we click cancel we will got redirected to the page www.sololearn.com
+ 6
@Vikash I don't want to send user to T&C page. Let, he came to my website from a link on www.sololearn.com. So, I want to redirect him to www.sololearn.com if he clicks back or cancel.
+ 6
@Vikash Actually I have no idea from where the users came to my page. I have taken www.sololearn.com just as an example. There can be any url instead of it.
+ 6
@Vikash Thanks for the help. It is exactly what I was searching for.
+ 6
@Vikash Ok, I will google it.
+ 5
wait i will post all code , wait bro
+ 5
@jan agreed it is good to use Gmail age verification.
+ 4
var confirm = confirm("Are you above 12?");
if(confirm){
window.location.href = "url of your website";
} else {
window.location.href= "url of your terms and conditions page";
}
+ 4
@Arushi Replace "url of your terms and condition page" with "www.sololearn.com".
+ 3
You can use window.history.go(-1)
+ 3
This is HTML5 History API. You can search on google for more info.