how to redirect someone from page B.html if before they haven't visited page A.html.
If page A.html is visited then allow to open and B.html.
All pages are html5
how to redirect someone from page B.html if before they haven't visited page A.html.
If page A.html is visited then allow to open and B.html.
All pages are html5
Set a cookie when the visitor goes to a.html. When the visitor navigates to b.html check to see if the cookie has been set, if not, initiate a redirect.
All this can be achieved using Javascript/jQuery / HTML.
jQuery cookie library: https://github.com/carhartl/jquery-cookie
Redirecting in JavaScript: How to redirect to another webpage in JavaScript/jQuery?
Include jQuery and the jQuery cookie plugin on both a.html and b.html. Make sure you download a copy of the jquery.cookie.js file from the github repo linked above.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="jquery.cookie.js"></script>
On page a.html use this snippet of code to set the cookie when your visitor loads the page:
<script>
$.cookie('page_a_visited', 'true', { expires: 7, path: '/' });
</script>
On page b.html add this code snippet to check if the vistor has the cookie set, and if not, redirect them back to page a.html:
<script>
if($.cookie('page_a_visited') !='true') {
window.location.replace("/a.html");
}
</script>