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.
Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 50
  1. #16
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,460
    Thanks
    11
    Thanked 600 Times in 580 Posts
    at the risk of hogging the mic...


    I'd like to step away for a moment from the usual enhancement vs requirement debate and offer another take on why js is vital.

    This is a fairly new argument that might not make a ton of sense to many devs at the moment, but will become increasingly clear over the next few years.

    It relates to information access and the changing ways we use browsers.

    A major downfall of server-side apps is that they need a server. They also need an active internet connection. If you are in the boondocks, a tunnel, and airplane or one of the increasing common public spaces where phones are jammed, you'll notice a sharp contrast between html5 apps and html3 apps.

    consider the following example application; a notepad that stores your notes and lets you edit/review them later.


    here is workable client code for the HTML3 version, which uses php to serve and store the notes:
    Code:
    <html>
    <head>
    	<title>notes</title>
    </head>
    <body>
    <form action= "mynotes.php"  method="POST" >
    	<select size='1' name='notes'>
    		<option>Choose a note</option>
    		<!-- server populates options here -->
    	</select>	
    	<input value='Load' type='submit'   name="load"  />
    	<input value='Save' type='submit'   name="save"  />	
    	&nbsp; | &nbsp;
    		
    
    	<label>Name <input  name="noteName" />	 </label>
    	<input value='Save As' type='submit'  name="saveas" />	
    
      <textarea rows='10' cols='80' id='data' name="data" ></textarea>	
    
    </form>	
    </body>
    </html>


    Imagine using this all the time (a stretch i know, but it's an example), and having it chock full of notes. You board a plane from LA to NY and hope to get some work done. Then they make you put your phone in airline mode and you have no internet. now what of your notes? How accessible are they to you, with or without javascript?



    now consider an html5 version that lives in a single stand-alone file.
    Code:
    <html>
    <head>
    	<title>notes</title>
    </head>
    <body>
    	<select size='1' onchange='if(this.selectedIndex) load(this.value)' id='notes' >
    		<option>Choose a note</option>
    	</select>	
    
    	<input value='Load'  type='button'  onclick="load()" />	
    	<input value='Save'  type='button'  onclick="save()" />	
    	&nbsp; 
    	<input value='Save As'  type='button'  onclick="saveAs()" />	
    	<hr />	
    
    	<textarea rows='10' cols='80' id='data'></textarea>	
    	
    <script type='text/javascript'>
    	function el(tid) {return document.getElementById(tid);}
    	
    	function load(name){
    		el("data").value=myNotes[name];
    	}
    
    	function save(){
    		document.title="Saved";
    		setTimeout(function(){  document.title="notes"; }, 1500);
    		myNotes[el("notes").value || "default" ]=el("data").value;
    		window.localStorage["notedata"]=JSON.stringify(myNotes);
    	}
    
    	function saveAs(){
    		var newName=prompt("Enter a name for the note"), 
    			elm=el("notes"), 
    			si= elm.selectedIndex;
    			if(!newName){return;}
    			elm.value=newName;
    			if(si==elm.selectedIndex){ elm.options[elm.options.length]=new Option(newName); elm.selectedIndex=elm.options.length-1; }
    		myNotes[newName]=el("data").value;
    		window.localStorage["notedata"]=JSON.stringify(myNotes);
    	}
    
    	window.onload=function(){
    		myNotes=JSON.parse(window.localStorage["notedata"] || "{}" ) || {};
    		var ops=el("notes").options;
    		Object.keys(myNotes).map(function(name, index){ ops[index+1]=new Option(name); })
    	};
    </script>	
    </body>
    </html>

    if you have this page's tab open in the browser, the html file saved on your computer, or you add a manifest attrib to the HTML tag, you can read and save notes during your flight. You control the data, you can edit the look of the app, and you can backup your own notes. Pretty cool features for a usable notepad if you ask me...


    now, it's not all black and white, keep these points in mind:
    • the html3 version lets you view notes on more than one machine.
    • The html5 version lets you view notes without the net.
    • the html3 version can get hacked, allowing someone else to steal your notes.
    • the html5 version's notes won't get stolen unless your device does.
    • if your devices gets stolen, the html3 version still has your notes safe and sound.
    • you can recover the notes from the HTML5 version if you have a computer backup, or a firefox profile backup, or if your browser backs up its settings automatically.
    • you can use sync or a plugin to read the HTML5 version notes on another computer, or export the notes to tumblr if needed.



    basically, my point is that there is more than one way to build an app, and every implementation choice has it's consequences. You need to weigh your target's needs and capabilities against your app's needed functionality, before making any final choices.


    Assuming that one model of interaction or the other is "always" the best place to start can really hamper envelope pushing and/or backward compatibility.
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%

  2. #17
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    Quote Originally Posted by rnd me View Post
    Another factor is cost. Despite some number thrown around about development, there are other costs associated with good javascript-less sites. Server-side scripting requires a host, which requires public registration, and usually credit-card payment for the plan.
    I don't see hosting costs as an issue nowadays. There are many good free hosting providers around nowadays (also some dodgy ones). I use one of Awardspace's ( see the link in my signature if interested) paid plans but they also offer a free hosting plan with no ads and with access to PHP and MySQL all for free.

    Quote Originally Posted by rnd me View Post
    Also, Lots of folks don't know server-side languages, and the penalty for back-end mistakes is MUCH higher than it is for annoying client-side script errors.
    I don't see the point you are making here. Looking at the posts in even just codingforums there are also a lot of people that don't know javascript.
    And the penalties for javascript errors can be just as high or higher than server side errors, especially if it is a client-side only web site.


    Quote Originally Posted by rnd me View Post
    But, if you are like the increasing number of developers creating HTML5 applications, i don't see a static fallback as possible or frankly, even desirable. Imagine google docs or maps without javascript...
    I think using html5 and css3 for commercial work is akin to playing with fire. You may or may not get burnt since html5 and css3 are not officially released by the w3c yet and are still in development. There is a good chance that html5 when it is released will at least in parts be different to what it is today. Also since browser support for html5 and css3 varies you are currently much more likely to run into browser compatibility issues with html5/css3.

    Also, why are you talking about HTML3? HTML4 was born circa 1999 (from memory) and since today's developers seem to be younger and younger I suspect many have not seen or used HTML3 as they were still in nappies when HTML4 came around .

    So what are we actually discussing in this thread? No-one is disputing that javascript can enrich a web page's user experience, so it's a "no-brainer" for me - if a functionality (data validation etc etc etc) can only be done using javascript then I use javascript, if it can be done either with javascript or server side I will always do it server side first, so that I don't have to have a Plan B for javascript disabled browsers, and then client side only if required as part of the web site specs.

    Quote Originally Posted by Philip M View Post
    @bullant - As you so often say, everyone is entitled to their opinion.
    no problem - at least you agree it's only an opinion and so consequently not necessarily actual fact .
    Last edited by bullant; 06-24-2011 at 11:37 AM. Reason: fixed spell errors

  3. #18
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,919
    Thanks
    6
    Thanked 1,040 Times in 1,013 Posts
    rnd_me, are you aware that HTML 4/XHTML 1 have been around for numerous years now?

    Aside from that, I think there is a general difference in the perception of the internet here: There are those people that see the world wide web as a collection of rich internet applications (like rnd_me) and those that see the web as a bunch of websites (like me). And not every website is an “app” that requires rich interaction or offline use or whatever. Let’s take the e-commerce system, for example, from which this discussion actually originated:

    I see no reason why JS would be required in current e-commerce systems except for a better shopping experience. Yet, the systems I had tested and/or struggled with relied on JS for the most basic tasks like adding a product to the cart. There is a regular form with a submit button (“add to cart”). The problem there is that the system adds a value from a select option to a hidden input dynamically upon clicking the “add” button and then submits the form. Without JS it would just submit a wrong value or nothing at all. And stuff like this just isn’t necessary. Likewise, the checkout process is disrupted because some more or less fancy show/hide effect doesn’t work and you can’t continue with the checkout. What the hell?

    This is what I mean. And this is nothing that would be overly hard to implement if you do it properly before thinking about nice AJAX effects and what not. The same is valid for websites like Facebook or MySpace or even Gmail that basically live through form submissions and the plain display of data. There is nothing that wouldn’t work without JS (at least in a more basic form). In fact, Google is even providing a plain HTML version of their e-mail program but separately from the “rich” version. I would dare to claim, however, that you don’t need to maintain two separate applications, you could even have one version that works without JS which you can then enhance with all these effects and functionality that make it “fun” and “easy” to write e-mails.

    Of course I’m not disputing that you can’t apply this principle to web applications like Google docs or stuff like that because this is clearly based on and only working with JavaScript because of the nature of these programs. This, however, isn’t valid for the majority of the internet which still consists of websites that are there to provide information which is supposed to be accessible to as many people as possible with whatever device they are using. Not without reason is it possible to disable JS in the first place. Browser vendors could as well have agreed on making JS an inseparable part of their program – why haven’t they?

  4. Users who have thanked VIPStephan for this post:

    Samhain13 (06-24-2011)

  5. #19
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,308
    Thanks
    203
    Thanked 2,563 Times in 2,541 Posts
    Having got that out of the way - one more time:-

    This is as serious and important topic, so I would welcome the views of other senior and respected (and I did say respected) members of this forum (especially Javascript moderators and perhaps even WA) on this topic.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  6. #20
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    Quote Originally Posted by Philip M View Post
    .....so I would welcome the views of other senior and respected (and I did say respected) members of this forum......
    thank you for the "invitation"
    Quote Originally Posted by Philip M View Post
    This is as serious and important topic,.....
    but I don't think it's as serious or important as you try to make out.

    Basically what I do is, if a function (say data validation etc etc or whatever) can only be done client side than I use javascript.

    If it can be done on both then I will always do it server side first, so I don't have to worry about javascript disabled browsers, and then do it client-side only if it's required according to the web site specs.

    That seems to be a "no-brainer" and very simple and uncomplicated to me.
    Last edited by bullant; 06-24-2011 at 10:27 AM.

  7. #21
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,308
    Thanks
    203
    Thanked 2,563 Times in 2,541 Posts
    Yes, you keep repeating yourself. I think we have all understood what you are endlessly whickering on about. Thank you. And Good-Night.

    The issue is not what you say. The question is whether time and money should be devoted to catering for the tiny minority of people thought to be 1%) who have elected to disable Javascript in their browsers.

    I am told that around 2% of users (more in Asia) still use IE6 - but no-one is going to code for IE6.

    VIP Stephan's argument strikes me as a somewhat evangelical approach - a counsel of perfection. And it seems to ignore the reality that (flawed or not) a huge number of sites do rely on Javascript for functionality.

    Modern logistics theory tells us that customer service levels should be set at typically 97-98% orders met from stock. The costs of attempting to provide a higher level of service (i.e. meet 100% of customer needs) become disproportionate and hence uneconomic. 1% of 1,000,000 is indeed 10,000. But it is still only 1%.

    99% of ordinary users would not know anything about Javascript, would not know what its use is or know how to disable it in the browser, still less why this might or might not be a good idea. Only computer experts will surf with Javascript disabled - and they can of course re-enable it if they need to do so to take advantage of the features of some particular site.

    My position is still that those who for whatever reason have Javascript disabled in their browsers have elected to do that, and ought to accept and endure the consequences.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  8. #22
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,919
    Thanks
    6
    Thanked 1,040 Times in 1,013 Posts
    Just so you don’t wonder: I have moved all the irrelevant posts to a new thread called “Philip’s and bullant’s playground” in the Active Members Lounge on http://www.codingforums.com/showthread.php?t=230283. You can get all loose there now.

    And just as a general heads-up: In future I’m going to delete everything that’s just meant to disgrace or offend another person and doesn’t contribute to a constructive discussion, even if it’s just a sentence in a post. So, bullant – I’m looking at you right now – if you ever want to see your defamations in public then keep on taking screenshots of them and post them on your ominous other secret website because you won’t see them here anymore as long as I’m around.

  9. Users who have thanked VIPStephan for this post:

    Philip M (06-24-2011)

  10. #23
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    ok thanks but they're not my websites and I also posted the PM you sent me after which WA sent me an apologetic reply after I forwarded it to him.
    Last edited by bullant; 06-24-2011 at 11:42 AM.

  11. #24
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    Quote Originally Posted by Philip M View Post
    My position is still that those who for whatever reason have Javascript disabled in their browsers have elected to do that, and ought to accept and endure the consequences.
    In my experience, I haven't come across a client yet willing to potentially loose any customers.

    For something that doesn't need to be coded client side there is virtually no extra cost to my clients for me to code the function both client and server side and in the few cases where there has been an increase in cost to also code a function in javascript the increase as a % of the total cost of the web site project has been trvial.

  12. #25
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,308
    Thanks
    203
    Thanked 2,563 Times in 2,541 Posts
    Quote Originally Posted by bullant View Post
    ok thanks but they're not my websites and I also posted the PM you sent me after which WA sent me an apologetic reply after I forwarded it to him.
    I would have thought that posting a moderator's PM on another website with the object of bringing codingforums.com into disrepute was quite enough to justify immediate banning.
    Last edited by Philip M; 06-24-2011 at 12:02 PM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  13. #26
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    Quote Originally Posted by Philip M View Post
    I would have thought that posting a moderator's PM on another website was quite enough to justify immediate banning.
    An extract from my PM to WA and cc'd to the mod as a courtesy to keep him in the loop.

    Now that others have seen VIPStephan's PM as well it is reflecting extremely poorly on his integrity and character......
    I am legally entitled to show it to whoever I like to get an opinion on whether it is slanderous and/or defamatory. WA replied saying he had spoken to the mod over the contents of his PM to me.
    Last edited by bullant; 06-24-2011 at 12:08 PM.

  14. #27
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,308
    Thanks
    203
    Thanked 2,563 Times in 2,541 Posts
    And codingforums is legally entitled to ban trouble makers with or without giving a reason. I am amazed that WA would seek to undermine his moderators in such a way - especially to you. In fact, I do not believe you.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  15. #28
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    Quote Originally Posted by Philip M View Post
    If WA had felt that somehow VIP Stephan had made unacceptable comments then he would have raised the matter with him privately.
    An extract from WA's reply to me:

    I've contacted VIPStephan reminding him of his obligations as a mod to always maintain a high level of professionalism when communicating with members. Sorry about that.
    I thanked WA for his reply. Imo WA acted promptly, appropriately and professionally in dealing with the PM VIPStephan sent me.

    If you have any issues with the way it was handled then take it up with WA directly.

  16. #29
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Quote Originally Posted by Philip M View Post
    This is as serious and important topic, so I would welcome the views of other senior and respected (and I did say respected) members of this forum
    Good job I'm not paranoid or sensitive.

  17. #30
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,308
    Thanks
    203
    Thanked 2,563 Times in 2,541 Posts
    Quote Originally Posted by MattF View Post
    Good job I'm not paranoid or sensitive.
    I'm not paranoid! Which of my enemies told you that?

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


 
Page 2 of 4 FirstFirst 1234 LastLast

Posting Permissions

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