Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Akram MONCER
force user to enable javascript/cookies
May 15, 2013 6:57 AM
Answer

Akram MONCER

Rank: Regular Member

Posts: 106

Join Date: September 25, 2012

Recent Posts

hi everyone

i created a liferay portlet, in which i use many JavaScript feature, the problem is if the user disable JavaScript and cookies in his browser all will be blocked.
so my question is how can i force user to enable javascript and cookies in his browser. or show a warning to the user that he have to activate them before he can d anything.

thanks
Subhash Pavuskar
RE: force user to enable javascript/cookies
May 15, 2013 10:05 AM
Answer

Subhash Pavuskar

Rank: Regular Member

Posts: 234

Join Date: March 12, 2012

Recent Posts

As per my knowledge you can't enable or disable JavaScript on a browser using code. If browsers allow a web page to play with it's settings, it would be very vulnerable.
Whenever you perform validations on a web page, the best practice is to do a client side as well as server side check.

Have look

 1<html>
 2<head></head>
 3<body>
 4<h1>noscript example</h1>
 5<noscript>
 6    <h3>JavaScript is disabled! Please enable JavaScript in your web browser!</h3>
 7
 8    <style type="text/css">
 9        #main-content { display:none; }
10    </style>
11</noscript>
12
13<div id="main-content">
14    <h3>Browser already enabled JavaScript!</h3>
15</div>
16
17</body>
18</html>