Reputation: 11
Security Question. I have jQuery code which prevents a tab from opening. So if I click on any tab it gives me an alert 'Access Denied'.
$('#tabs').tabs({
select: function(event, ui) {
var valid = false;
if(!valid)
{
// prevent further action
alert('Access Denied');
event.preventDefault();
}
}
});
But as I can change script using Firebug or any other tool, I can set variable valid
from false
to true
and it will allow me to access all tabs. Is there a way we can restrict this?
Upvotes: 1
Views: 512
Reputation: 388316
There is no way to do it using javascript, anybody can intercept and hack it using client side tools like Firebug, Firefox Dev Tools, IE Dev Tools, Chrome Dev Tools, Fiddler etc.
If you really wants to prevent somebody from seeing some tabs, you need to prevent its contents from server side. ie: the contents of the tabs should not be rendered to the client.
Upvotes: 4
Reputation: 2739
Nope you can't restrict this. You cannot provide security using any clientside scripting language such as Javascript. The Javascript is under the control of the end-user and thus it can be changed, you have to do it on the server-side; as at this stage you have control of the computer it's running on.
Upvotes: 0