Client side page permissions - Javascript / jquery / cookies / other?

Posted by Ozaki on Stack Overflow See other posts from Stack Overflow or by Ozaki
Published on 2010-05-25T02:30:27Z Indexed on 2010/05/25 2:41 UTC
Read the original article Hit count: 418

Filed under:
|
|
|

TLDR Using plain HTML / Javascript. Want to block access to some pages (doesn't have to be super secure just to stop some peeking eyes).


I thought of simply doing this by setting a cookie for each page they are allowed to visit with a value of true but thats a bit messy. Although it would work. Is there a way to set an array of values to a cookie so I can read the cookie and if a name of a page is in there then allow access with an IF statement or so on each of my pages. If they dont have the cookie just to replace my #content (entirepage) to "sorry no" etc.

For example:

 $.cookie("Access","page1, page2, page3",{ expires: 1 });

Am already using JQuery, Jquery cookie. etc.

I am up for anyway of doing this cookie idea is just an example


So what do you think would be the best / most efficient way of managing this?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery