How do I stop page processing if Javascript in disabled?

Posted on 2010-01-02
Last Modified: 2013-12-20

I am developing with Coldfusion and most of my site is Javascript dependent.  Rather than writing hundreds of lines of <noscript> code variance, I want to simply stop page processing when the user has Javascript disabled, and display a message that says "You must have Javascript enabled to view this site."

I have tried several ways to do this, but no luck.

Does anyone know how to do this?
Question by:chaseivey
    LVL 22

    Accepted Solution

    LVL 63

    Assisted Solution

    The problem is that cftags are executed before any <script> tag or <noscript> tags are evaluated.
    Terefore you need to check once that client browser has script enabled and use that check result in a session variable and do not checks from there on.
    For that you can define one session veraible and check for existance of that variable in the Application.cfm (or .cfc) and if it is not existant then do a postback for defining that variable trough JavaScript.

    Do you need an example or can you check that on your own?


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Live - One-on-One JavaScript Help from Top Experts

    Solve your toughest problems, fast.
    JavaScript experts are online now and ready to help you.

    What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
    JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
    Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
    The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now