Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > turning off javascript..

Reply
Thread Tools

turning off javascript..

 
 
The Natural Philosopher
Guest
Posts: n/a
 
      12-22-2009
Ok, this is a very general question. I am designing the public facing
part of a sales website, and want to be as compatible as I can with
everybody, as opposed to the internal side,where I used what was in
house standard to full effect.

In a way this is an odd post, because its about NOT using javascript.

Let me explain. To date, the simplest way of making anything 'do
something' when clicked, was to attach a basic event handler, and call a
URL and set one or more post variable using js.

Now, if I posit 'javascript off' I must needs do it with straight URLS,
and only GET variables embedded in it to control server side behaviour.

Or is there a way to set up one or more POST variables from a click on a
URL? I am not totally enamoured with multiple submit buttons either..
but its a possibility..

How do others approach this problem, and why?

On a similar note, I guess there is no way to have flyout menus without
a server reload..if js is off, either..

Or should I just say 'sod it: if they want to use this site, its JUST
possible without JS, but its ugly and clunky, and its there fault for
not turning it on' ?
 
Reply With Quote
 
 
 
 
JR
Guest
Posts: n/a
 
      12-22-2009
On Dec 22, 12:25*pm, The Natural Philosopher <(E-Mail Removed)>
wrote:

> In a way this is an odd post, because its about NOT using javascript.
>
> Let me explain. To date, the simplest way of making anything 'do
> something' when clicked, was to attach a basic event handler, and call a
> URL and set one or more post variable using js.
>
> Now, if I posit 'javascript off' I must needs do it with straight URLS,
> and only GET variables embedded in it to control server side behaviour.
>
> Or is there a way to set up one or more POST variables from a click on a
> URL? *I am not totally enamoured with multiple submit buttons either..
> but its a possibility..
>
> How do others approach this problem, and why?
>
> On a similar note, I guess there is no way to have flyout menus without
> a server reload..if js is off, either..
>
> Or should I just say 'sod it: if they want to use this site, its JUST
> possible without JS, but its ugly and clunky, and its there fault for
> not turning it on' ?


It's possible to develop a website without using javascript in the
client-side. Take a look at Amazon and Google Maps for instance: they
don`t look `ugly and clunky` without JS. Menus can be achieved with
CSS only. But `post` can only be used within a form, I think.

Cheers,
JR
 
Reply With Quote
 
 
 
 
Erwin Moller
Guest
Posts: n/a
 
      12-22-2009
The Natural Philosopher schreef:

Hi TNP,

> Ok, this is a very general question. I am designing the public facing
> part of a sales website, and want to be as compatible as I can with
> everybody, as opposed to the internal side,where I used what was in
> house standard to full effect.
>
> In a way this is an odd post, because its about NOT using javascript.
>
> Let me explain. To date, the simplest way of making anything 'do
> something' when clicked, was to attach a basic event handler, and call a
> URL and set one or more post variable using js.
>
> Now, if I posit 'javascript off' I must needs do it with straight URLS,
> and only GET variables embedded in it to control server side behaviour.


And a lot more of course.
You have forms with all kind of elements in it: radiobutton, checkboxes,
etc. Using them smart can make things easy and intuitive for the user,
even with JavaScript disabled.

About the GET, I prefer putting everything in a POST instead of GET.
When some elements contain a lot of characters (textarea for example)
GET will get you in trouble on some setups. (If memory serves me well:
IIS used to accept 2048 characters or something as a maximum in the URL
itself).

And you can always write info from the URL inside the forms, using
hidden variables.


>
> Or is there a way to set up one or more POST variables from a click on a
> URL? I am not totally enamoured with multiple submit buttons either..
> but its a possibility..



Without JavaScript you MUST solve your problems with the standard
elements in the form. So if you need more submitbuttons, do that.
For example:
<input type="text" name="whatever">
<input type="submit" name="submitbutton" value="update">
<input type="submit" name="submitbutton" value="delete"
style="background:#FF0000;">

is perfectly easy to understand for the user I expect.
At the server you simply get the value for submitbutton and do your stuff.
I have no problems with multiple submitbutton. Do you?


>
> How do others approach this problem, and why?



The best approach is to code for both JavaScript enabled visitors and
disabled visitors alike.
I have been in situations where I found it easier to branch my scripts:
One for enabled, one for disabled: It is not a great solution, but I had
cases where I needed loads of happy complex (for me) JavaScript that
could drag and drop, place images over others, etc.
The JS-disabled version only needed 2 coordinates, so I thought
branching the pages I served was easier.

However, in most (even all I expect) cases it is possible to write one
page that handles both enabled and disabled JavaScript fine.


>
> On a similar note, I guess there is no way to have flyout menus without
> a server reload..if js is off, either..


That IS possible with CSS.
You don't need JavaScript at all for that.
Google for: css drop down menu no javascript

(HTML5 will support this kind of menus without css, but that is of no
use for you now.)


>
> Or should I just say 'sod it: if they want to use this site, its JUST
> possible without JS, but its ugly and clunky, and its there fault for
> not turning it on' ?



In the end, that is for your client to decide.
Estimates I heard are that 2% to 8% have JavaScript disabled.
But it is hard to get reliable numbers on that I understood, so make up
your own mind.

Telling them to sod it might result in 2-8% lower sales.

I have made sites that were only usable with JavaScript enabled. If my
client wants that and don't want to spend a dime extra for the
JavaScript disbled browsers, I make it like that even tough I dislike it.

In my opinion it is often possble to code for both situations straight
away with little extra effort, like form validation.
I know you are a PHP programmer, so you do the serverside validation
anyway.
It is not hard at all to return the form with problematic fields
highlighted, and only accept at the server when they are fine.

But that is formvalidation. I am not sure what it is you are working on
excactly now, maybe there is more involved.


Just my 2 cent.

Regards,
Erwin Moller


--
"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare
 
Reply With Quote
 
The Natural Philosopher
Guest
Posts: n/a
 
      12-22-2009
Erwin Moller wrote:
> The Natural Philosopher schreef:
>
> Hi TNP,
>
>> Ok, this is a very general question. I am designing the public facing
>> part of a sales website, and want to be as compatible as I can with
>> everybody, as opposed to the internal side,where I used what was in
>> house standard to full effect.
>>
>> In a way this is an odd post, because its about NOT using javascript.
>>
>> Let me explain. To date, the simplest way of making anything 'do
>> something' when clicked, was to attach a basic event handler, and call
>> a URL and set one or more post variable using js.
>>
>> Now, if I posit 'javascript off' I must needs do it with straight
>> URLS, and only GET variables embedded in it to control server side
>> behaviour.

>
> And a lot more of course.
> You have forms with all kind of elements in it: radiobutton, checkboxes,
> etc. Using them smart can make things easy and intuitive for the user,
> even with JavaScript disabled.
>


Oh I use all that already.

> About the GET, I prefer putting everything in a POST instead of GET.
> When some elements contain a lot of characters (textarea for example)
> GET will get you in trouble on some setups. (If memory serves me well:
> IIS used to accept 2048 characters or something as a maximum in the URL
> itself).
>
> And you can always write info from the URL inside the forms, using
> hidden variables.
>


well no, typically without JS you cant.

You can at best set one post variable per submit button.

Not half a dozen after a lot of logic

Not insuperable..but the dirt all goes to the server.

>
>>
>> Or is there a way to set up one or more POST variables from a click on
>> a URL? I am not totally enamoured with multiple submit buttons
>> either.. but its a possibility..

>
>
> Without JavaScript you MUST solve your problems with the standard
> elements in the form. So if you need more submitbuttons, do that.
> For example:
> <input type="text" name="whatever">
> <input type="submit" name="submitbutton" value="update">
> <input type="submit" name="submitbutton" value="delete"
> style="background:#FF0000;">
>
> is perfectly easy to understand for the user I expect.
> At the server you simply get the value for submitbutton and do your stuff.
> I have no problems with multiple submitbutton. Do you?
>


I have a problem with submit buttons AT ALL in that they are limited in
stylistic capabilities.

And then someone hits the 'enter' key..
>
>>
>> How do others approach this problem, and why?

>
>
> The best approach is to code for both JavaScript enabled visitors and
> disabled visitors alike.
> I have been in situations where I found it easier to branch my scripts:
> One for enabled, one for disabled: It is not a great solution, but I had
> cases where I needed loads of happy complex (for me) JavaScript that
> could drag and drop, place images over others, etc.
> The JS-disabled version only needed 2 coordinates, so I thought
> branching the pages I served was easier.
>


Nice trick. I'll tuck that one away..for later.

> However, in most (even all I expect) cases it is possible to write one
> page that handles both enabled and disabled JavaScript fine.
>
>
>>
>> On a similar note, I guess there is no way to have flyout menus
>> without a server reload..if js is off, either..

>
> That IS possible with CSS.
> You don't need JavaScript at all for that.
> Google for: css drop down menu no javascript
>


Hmm. how do you toggle visible/invisible without JS?

> (HTML5 will support this kind of menus without css, but that is of no
> use for you now.)
>
>
>>
>> Or should I just say 'sod it: if they want to use this site, its JUST
>> possible without JS, but its ugly and clunky, and its there fault for
>> not turning it on' ?

>
>
> In the end, that is for your client to decide.
> Estimates I heard are that 2% to 8% have JavaScript disabled.
> But it is hard to get reliable numbers on that I understood, so make up
> your own mind.
>
> Telling them to sod it might result in 2-8% lower sales.
>


Ok Fairy Nuff!

> I have made sites that were only usable with JavaScript enabled. If my
> client wants that and don't want to spend a dime extra for the
> JavaScript disbled browsers, I make it like that even tough I dislike it.
>
> In my opinion it is often possble to code for both situations straight
> away with little extra effort, like form validation.
> I know you are a PHP programmer, so you do the serverside validation
> anyway.
> It is not hard at all to return the form with problematic fields
> highlighted, and only accept at the server when they are fine.
>
> But that is formvalidation. I am not sure what it is you are working on
> excactly now, maybe there is more involved.
>
>
> Just my 2 cent.
>


Worth a few dollars at least. As usual, thought provoking, clear and
helpful. Thanks.

> Regards,
> Erwin Moller
>
>

 
Reply With Quote
 
The Natural Philosopher
Guest
Posts: n/a
 
      12-22-2009
Swifty wrote:
> JR wrote:
>> But `post` can only be used within a form, I think.

>
> Indeed, but if you *want* the "Submit" button to look like a link, you
> can do that simply enough with CSS (I could do it, which is my
> definition of "simply enough").
>

Problem I have with the submit button, is that if you style it with an
image of non square shape, with a transparent edge to it, what shows
through is NOT the background image of the containing element, but the
plain background COLOR of the containing element. Or possibly the
background color of the button itself. Hmm. Perhaps that's the problem.


Can you set a style to 'background color: transparent ?
 
Reply With Quote
 
Doug Miller
Guest
Posts: n/a
 
      12-23-2009
In article <hgreb8$r8d$(E-Mail Removed)>, The Natural Philosopher <(E-Mail Removed)> wrote:
>Doug Miller wrote:


>I think I dint make myself clear. With js I can fire an evfent handler.,
>set any amount of post variables, and do a submit. I can even submit to
>a totally different target or spawn a popup window.
>
>With strict HTML one button=one vale,


No. The array of POST variables sent to the server includes all named input
elements in the form, regardless of how many submit buttons there are.

> and unless I use two forms, one
>target URL and no spaewning of windows.
>
>With a straight URL I can spawn a window, but how to pass variables to
>it? Except with 'get'
>Cookies?


Use POST to pass the values to a server-side script which then generates the
code to spawn the new window. This is trivially easy with PHP.
>
>>> How do others approach this problem, and why?

>>
>> One approach: server-side scripting (PHP or ASP) using POST variables.
>> Reasons: faster execution, better security, works even if user has JS
>> disabled.

>
>Well I do that already. However its a page load every time, and that
>gets clunky. This server for other reasons sits on a slow link.
>
>>> On a similar note, I guess there is no way to have flyout menus without
>>> a server reload..if js is off, either..

>>
>> Sure there is. Flyout menus can be achieved with pure CSS, and no JS at all.
>>> Or should I just say 'sod it: if they want to use this site, its JUST
>>> possible without JS, but its ugly and clunky, and its there fault for
>>> not turning it on' ?

>>
>> I would say it's the developer's fault for not making a site that will
>> function even without JS.

>
>Well Its certainly worth making the attempt I suppose. You are damned if
>you do ('doesn't work properly without java script') and damned if you
>dont ('its dull and old fashioned and slow')


There's no reason for a JS-free site to be dull and old-fashioned. That's
purely the result of failed site design, unrelated to the technologies used to
implement the site.
>
>There's a LOT of sites out there than ONLY work on IE5/6/7/8


And shame on the boobs that designed and implemented them.
 
Reply With Quote
 
Doug Miller
Guest
Posts: n/a
 
      12-23-2009
In article <hgrehi$rlh$(E-Mail Removed)>, The Natural Philosopher <(E-Mail Removed)> wrote:
>Swifty wrote:
>> JR wrote:
>>> But `post` can only be used within a form, I think.

>>
>> Indeed, but if you *want* the "Submit" button to look like a link, you
>> can do that simply enough with CSS (I could do it, which is my
>> definition of "simply enough").
>>

>Problem I have with the submit button, is that if you style it with an
>image of non square shape, with a transparent edge to it, what shows
>through is NOT the background image of the containing element, but the
>plain background COLOR of the containing element. Or possibly the
>background color of the button itself. Hmm. Perhaps that's the problem.


Perhaps the problem is how you've defined the button.Do you have
<input type="submit"...> or <input type="image"...> ?
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      12-23-2009
Doug Miller wrote:

> The Natural Philosopher wrote:
>> I think I dint make myself clear. With js I can fire an evfent handler.,
>> set any amount of post variables, and do a submit. I can even submit to
>> a totally different target or spawn a popup window.
>>
>> With strict HTML one button=one vale,

>
> No. The array of POST variables sent to the server includes all named
> input elements in the form, regardless of how many submit buttons there
> are.


There is no "array of POST variables". The message body of an HTTP POST
request is a string, with a HTML form it is usually

name1=value1&name2=value2

etc., with names and values URL-encoded. It is only the server-side
application, e.g. PHP, that makes an (associative) array (e.g.,
$HTTP_POST_VARS or $_POST) out of it.


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
 
Reply With Quote
 
Doug Miller
Guest
Posts: n/a
 
      12-23-2009
In article <(E-Mail Removed)>, Thomas 'PointedEars' Lahn <(E-Mail Removed)> wrote:
>Doug Miller wrote:
>
>> The Natural Philosopher wrote:
>>> I think I dint make myself clear. With js I can fire an evfent handler.,
>>> set any amount of post variables, and do a submit. I can even submit to
>>> a totally different target or spawn a popup window.
>>>
>>> With strict HTML one button=one vale,

>>
>> No. The array of POST variables sent to the server includes all named
>> input elements in the form, regardless of how many submit buttons there
>> are.

>
>There is no "array of POST variables".


From the perspective of a server-side script, there certainly is (e.g. $_POST
in PHP).

>The message body of an HTTP POST
>request is a string, with a HTML form it is usually
>
> name1=value1&name2=value2
>
>etc., with names and values URL-encoded. It is only the server-side
>application, e.g. PHP, that makes an (associative) array (e.g.,
>$HTTP_POST_VARS or $_POST) out of it.


I'm afraid you've missed the point altogether, which is that I was correcting
the previous poster's misapprehension that only one value could be transmitted
per submit button.
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      12-23-2009
Doug Miller wrote:

> Thomas 'PointedEars' Lahn wrote:
>> Doug Miller wrote:
>>> The Natural Philosopher wrote:
>>>> I think I dint make myself clear. With js I can fire an evfent

^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>> handler., set any amount of post variables, and do a submit. I can even

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^
>>>> submit to a totally different target or spawn a popup window.
>>>>
>>>> With strict HTML one button=one vale,
>>> No. The array of POST variables sent to the server includes all named
>>> input elements in the form, regardless of how many submit buttons there
>>> are.

>> There is no "array of POST variables".

>
> From the perspective of a server-side script, there certainly is (e.g.
> $_POST in PHP).


The perspective was not any server-side application here.

>> The message body of an HTTP POST
>> request is a string, with a HTML form it is usually
>>
>> name1=value1&name2=value2
>>
>> etc., with names and values URL-encoded. It is only the server-side
>> application, e.g. PHP, that makes an (associative) array (e.g.,
>> $HTTP_POST_VARS or $_POST) out of it.

>
> I'm afraid you've missed the point altogether, which is that I was
> correcting the previous poster's misapprehension that only one value could
> be transmitted per submit button.


No, I did notice that. Your answer was partially wrong anyway (as the
question was completely wrong).


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Turning off the '?' in IOS John Chajecki Cisco 4 12-17-2005 03:33 PM
Turning off offline files sync on wireless connection Jon Earley Wireless Networking 0 05-23-2005 03:14 PM
Re: Catalyst 2950 24 - turning fan off Ben Cisco 2 11-23-2004 12:33 PM
Turning off spanning on 2950's panda Cisco 7 10-11-2004 06:54 AM
Turning sounds off only in Mozilla BrainstormingSW Firefox 6 04-07-2004 02:32 PM



Advertisments