Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2009
    Posts
    34
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Help-Prevent page from loading if java is not enabled

    Hi all,

    Is there any method which blocks the website from loading, if the browser using is not java script enabled? I have a webpage with some details to be entered. This website is designed in such a way that it checks the exceptions in the entry and alerts the user regarding it which is done using javascript. but for some users this feature is not working. I guess its the problem with the browser they use. So how can I alert them to enable Java by adding something to the script? Is there any way which prevents the page from loading if java is not enabled in the browser? It would be a great help if some one can help in this.

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    First at all, make yourself clear. Are you talking about Java? Or Javascript? They are different languages.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New Coder
    Join Date
    Jan 2009
    Posts
    34
    Thanks
    4
    Thanked 0 Times in 0 Posts
    I just want to alert the user if his browser does not support javascript and also alert him if it is not enabled.

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,173
    Thanks
    203
    Thanked 2,549 Times in 2,527 Posts
    If Javascript is not enabled, then you cannot run a script to find out if Javascript is enabled or not.

    The best you can do is use a <NOSCRIPT> tag. The <NOSCRIPT> tag is used to provide an alternate content for users that have disabled scripts in their browser or have a (ancient?) browser that doesn’t support client-side scripting. The content inside the noscript element will only be displayed if scripts are not supported, or are disabled in the user’s browser.

    <script type="text/javascript">
    document.write("Hello World!")
    </script>
    <noscript>Your browser does not support JavaScript or it is not enabled!</noscript>

    Note that you cannot use an alert which is Javascript which is disabled!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •