Fórum

force user to enable javascript/cookies

Akram MONCER, modificado 10 Anos atrás.

force user to enable javascript/cookies

Regular Member Postagens: 106 Data de Entrada: 25/09/12 Postagens Recentes
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
thumbnail
Subhash Pavuskar, modificado 10 Anos atrás.

RE: force user to enable javascript/cookies

Regular Member Postagens: 234 Data de Entrada: 13/03/12 Postagens Recentes
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




<h1>noscript example</h1>
<noscript>
	<h3>JavaScript is disabled! Please enable JavaScript in your web browser!</h3>
 
	<style type="text/css">
		#main-content { display:none; }
	</style>
</noscript>
 
<div id="main-content">
	<h3>Browser already enabled JavaScript!</h3>
</div>