Requiring that javascript is enabled

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Requiring that javascript is enabled

Mike Ealy-2
I need to require my users have javascript enabled in their browser.

I know I can display a simple message like this.

    <noscript>Your browser does not support JavaScript! Do not proceed until
JavaScript is enabled.</noscript>

However, I'd like to do something like this:

if javascript is enabled
    <form ... >
        <table>
            ...
        </table>
    </form>
else
  <noscript>Your browser does not support JavaScript! ... </noscript>
/if

I'm not sure how to code something like this with Lasso.

Thanks,
Mike



#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Requiring that javascript is enabled

stevepiercy
You don't.  Lasso is server-side, javascript is client-side.  
You could put the form in a <script> block.
http://www.w3.org/TR/html4/interact/scripts.html#h-18.3.1

--steve


On 11/16/11 at 3:03 PM, [hidden email] (Mike Ealy) pronounced:

>I need to require my users have javascript enabled in their browser.
>
>I know I can display a simple message like this.
>
><noscript>Your browser does not support JavaScript! Do not proceed until
>JavaScript is enabled.</noscript>
>
>However, I'd like to do something like this:
>
>if javascript is enabled
><form ... >
><table>
>...
></table>
></form>
>else
><noscript>Your browser does not support JavaScript! ... </noscript>
>/if
>
>I'm not sure how to code something like this with Lasso.
>
>Thanks,
>Mike
>
>
>
>#############################################################
>This message is sent to you because you are subscribed to
>the mailing list Lasso
>[hidden email]
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Steve Piercy               Web Site Builder              
Soquel, CA
<[hidden email]>                  <http://www.StevePiercy.com/>

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Requiring that javascript is enabled

Steve Upton
In reply to this post by Mike Ealy-2
At 3:03 PM -0500 11/16/11, Mike Ealy wrote:

>I need to require my users have javascript enabled in their browser.
>
>I know I can display a simple message like this.
>
>    <noscript>Your browser does not support JavaScript! Do not proceed until
>JavaScript is enabled.</noscript>
>
>However, I'd like to do something like this:
>
>if javascript is enabled
>    <form ... >
>        <table>
>            ...
>        </table>
>    </form>
>else
>  <noscript>Your browser does not support JavaScript! ... </noscript>
>/if
>
>I'm not sure how to code something like this with Lasso.
>

how about something like this:

Put the stuff you want displayed when Javascript is active into a div like this

<div id="JSlive" style="display:none;">
        your stuff
</div>

then on page load, run a small script that does:

document.getElementById('JSlive').show();

then if JS is active your content will show. It's important to put the Display:none in the element's style rather than in a style sheet otherwise you won't be able to display it. (code examples not tested)

HTH

regards,

Steve Upton

--

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

RE: Requiring that javascript is enabled

Rick Draper-2
In reply to this post by Mike Ealy-2
Hi Mike,

We actually divert them to another page as follows...

<noscript>
<meta http-equiv="Refresh" content="1; URL=/error_js.amtac">
</noscript>

This is placed in the head of every page (except the error_js.amtac page, or course)

Very best regards,

Rick


#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Requiring that javascript is enabled

Mike Ealy-2
In reply to this post by Mike Ealy-2
This will work.

<noscript>
    <meta http-equiv="refresh" content="0;
url=https://......./no_javascript.html"/>
</noscript>

Thanks for your comments.

Mike



> I need to require my users have javascript enabled in their browser.
>
> I know I can display a simple message like this.
>
>     <noscript>Your browser does not support JavaScript! Do not proceed until
> JavaScript is enabled.</noscript>
>
> However, I'd like to do something like this:
>
> if javascript is enabled
>     <form ... >
>         <table>
>             ...
>         </table>
>     </form>
> else
>   <noscript>Your browser does not support JavaScript! ... </noscript>
> /if
>
> I'm not sure how to code something like this with Lasso.
>
> Thanks,
> Mike
>
>
>
> #############################################################
> This message is sent to you because you are subscribed to
>   the mailing list Lasso
> [hidden email]
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>


#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Requiring that javascript is enabled

Wade Maxfield
In reply to this post by Steve Upton
On 17/11/2011, at 9:30 AM, Steve Upton wrote:

> then on page load, run a small script that does:
>
> document.getElementById('JSlive').show();
>


I think .show() is only in jQuery (or maybe Prototype) so if you are using just plain javascript that should be

document.getElementById('JSlive').style.display = 'block';


> then if JS is active your content will show. It's important to put the Display:none in the element's style rather than in a style sheet otherwise you won't be able to display it. (code examples not tested)

I don't think that's the case with modern browsers. I don't use inline styles and I have no issues showing items I've hidden via external stylesheets. I'm solely using jQuery but that shouldn't make any difference.

EDIT:

That does make a difference.  Using the plain javascript had no issues with external stylesheet, jQuery had no issue either. But reading the prototype documentation .show() has an issue with the external stylesheet.

http://www.prototypejs.org/api/element/show

Steve do you use Prototype?

 - Wade


#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Requiring that javascript is enabled

Johan Solve
In reply to this post by Rick Draper-2
Oh, that wasn't valid before html5. Nice!

2011/11/16 Rick Draper <[hidden email]>:

> Hi Mike,
>
> We actually divert them to another page as follows...
>
> <noscript>
> <meta http-equiv="Refresh" content="1; URL=/error_js.amtac">
> </noscript>
>
> This is placed in the head of every page (except the error_js.amtac page, or course)
>
> Very best regards,
>
> Rick
>
>
> #############################################################
> This message is sent to you because you are subscribed to
>  the mailing list Lasso
> [hidden email]
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>
>



--
Mvh
Johan Sölve
____________________________________
Montania System AB
Halmstad   Stockholm
http://www.montania.se

Johan Sölve
Mobil +46 709-51 55 70
[hidden email]

Kristinebergsvägen 17, S-302 41 Halmstad, Sweden
Telefon +46 35-136800 |  Fax +46 35-136801
#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Requiring that javascript is enabled

Steve Upton
In reply to this post by Wade Maxfield
At 9:59 AM +1300 11/17/11, Wade Maxfield wrote:
>On 17/11/2011, at 9:30 AM, Steve Upton wrote:
>
>Steve do you use Prototype?
>

yep. I guess I have forgotten what bits come from what parts.

thanks for the clarification.

Regards,

Steve

--

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>