Reputation: 103
Basically I am creating a landing page for customer wifi, we already have a way of the page being the first to load, now I want to go one further. I want the customers to agree to our usage policy before they can continue, so basic stuff, create a page, add T&C's and a check box and an accept button, check to box click accept and you are on your way to internet awesomeness!
Except users could bypass this by changing the address in the address bar. What I want to do is disable any address changes, thus disabling the address bar
Is it possible to do this using a simple javascript? Is there an easier way of solving this issue?
Upvotes: 0
Views: 3405
Reputation: 65889
This works for me:
<html>
<script for="window" event="onload">
window.open('main.jsp',
'Window',
'width=800,height=600,resizable=0,status=0,toolbar=0');
// Hack to bypass the confirm alert on window close.
window.opener = window.top;
window.open('', '_self', '');
window.close();
</script>
</html>
This opens a new window on main.jsp with reduced abilities and closes the launched window (which comes from index.jsp).
And - contrary to popular belief - the new window does not have an address bar. In fact it also doesn't have a close box either but you can change that.
P.S. - This might only work for IE.
Upvotes: 2
Reputation: 4812
you cant lock the browser address bar, no.
normally they just route every page request, except from your domain, to your page until someone has accepted/verified
Upvotes: 2
Reputation: 2730
You can use javascript confirm box:
var result=confirm("Press a button!")
if (result==true)
{
alert("You pressed OK!")
}
else
{
alert("You pressed Cancel!")
}
}
And make some condition..if the user presses ok then do something, else you can redirect him to some other page...though these alerts really interfere with UI experience..
Upvotes: -1