473,387 Members | 1,391 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Block if javascript is disabled

chathura86
227 100+
hi

Is there a way to block users from accessing my site if
the javascript is disabled (or not supported) in the browser

it is ok to block them from server if necessary. i'm using PHP
as the serverside lang.

any how i want to keep non-javasctipt users out

regards

chathura bamunusinghe
Sep 27 '08 #1
4 1759
acoder
16,027 Expert Mod 8TB
Instead of trying to block the user, use the <noscript> tag to display content or a message when JavaScript is disabled.
Sep 27 '08 #2
chathura86
227 100+
well <nosctipt> will only inform the user that his browser does not support
javascript and the page will be displayed on the screen

i'm looking for a way to block the user from viewing the page if his browser
does not support javascript

i'm not sure whether it is posible to do it

thanks for the help

regards

chathura bamunusinghe
Sep 27 '08 #3
acoder
16,027 Expert Mod 8TB
There's no point in trying to block the user and you can't check JavaScript settings on the server.

The noscript tag doesn't need to display that JavaScript is disabled. It could have something useful instead. Why do you want to block the page anyway?
Sep 27 '08 #4
rnd me
427 Expert 256MB
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>JavaScript Required!</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6.  
  7. <style type='text/css'>
  8.     body { display    : none; }
  9. </style>
  10.  
  11. </head>
  12. <body onload="boot()">
  13.  
  14. Hello World.      Hello World.      Hello World.      Hello World.  <br />
  15.     Hello World.      Hello World.      Hello World.      Hello World.  <br />
  16.     Hello World.      Hello World.      Hello World.      Hello World.      <br />
  17. Hello World.      Hello World.      Hello World.      Hello World.      Hello World.  <br />
  18.     Hello World.      Hello World.      Hello World.      Hello World.  <br />
  19.     Hello World.      Hello World.      Hello World.      Hello World.      <br />
  20. Hello World.      Hello World.      Hello World.      Hello World.      Hello World.  <br />
  21.     Hello World.      Hello World.      Hello World.      Hello World.      Hello World.  
  22. <script type='text/javascript'>
  23.  
  24.     function boot(){
  25.         document.styleSheets[0].disabled = true;        
  26.         document.title=" Welcome to my page";
  27.     }
  28.  
  29. </script>
  30. </body>
  31. </html>
Sep 29 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Kai Grossjohann | last post by:
It seems that Ctrl-N in Mozilla opens a new empty browser window. That's fine, I don't need to do anything about it. But Ctrl-N in IE appears to clone the current window. Is there a way to...
30
by: Mason A. Clark | last post by:
If I use javascript on my page, how likely is it that the viewer will not have javascript? Anyone have data? Mason C
6
by: Stu Carter | last post by:
Hi, I have an aspx page where some controls are initially disabled by the code-behind 'Page_Load' event. I want these controls to be dynamically enabled when the user checks a checkbox. ...
1
by: tshad | last post by:
I need to do some work with Javascript and my datagrid controls. I want to do something like: ********************************************************* function CheckQuestion() { var checkBox...
7
by: Roman | last post by:
I am wondering if anybody can provide statistics what is percentage of visitors with disabled JavaScript. Even more interesting would be statistics of users with disabled JavaScript making a...
6
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - I have <a href="javascript:somefunction()"what .... ?...
3
by: bhanubalaji | last post by:
hi, I am unable to disable the text(label) in javascript..it's working fine with IE,but i am using MOZILLA.. can any one help regarding this.. What's the wrong with my code? I am...
5
by: Steve Swift | last post by:
Is there an event which is triggered when JavaScript is about to be disabled? -- Steve Swift http://www.swiftys.org.uk/swifty.html http://www.ringers.org.uk
1
by: ibeehbk | last post by:
HI. I have a dropdown menu named arrivalcity (options are Rome, Naples, Palermo, and CAtania). I also have 4 other dropdown menus which have departure dates for those cities. Basically I want...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.