Can we manage client-side widget/plugin using server-side JS?
Hi Folks,
I want to use JavaScript widgets/plugins from any JS library (YUI, jQuery, MooTools, etc.,..) into a website. Widget/plugin can be anything i.e., DatePicker, Image-slideshow, Accordion, Tabs, TreeView, Vertical/Horizontal menus etc.
As of now, I know, to make any JS widget/plugin functional, JavaScript should be enabled in browser/client.
But is there any way to initialize these widgets and control them from server using server-side JavaScript to make them functional and working even JavaScript is disabled in Browser/client-side.
I want to use JavaScript widgets/plugins from any JS library (YUI, jQuery, MooTools, etc.,..) into a website. Widget/plugin can be anything i.e., DatePicker, Image-slideshow, Accordion, Tabs, TreeView, Vertical/Horizontal menus etc.
The number of people who have Javascript disabled in their browser is somewhat debatable. Some put it as high as 10%. For myself I have never encountered any individual who has (or would know how to) disable Javascript. It may be done by some corporate system administrators.
__________________
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.
many widgets like menus, tabs, sliders, accordions, slideshows, and video players can be pulled off using only CSS and HTML.
tree views and legacy datepickers might be tough to code without JS. if the tree could resort to "fully expanded" for non-js users it would be much simpler and less janky.
you can use hidden radios, #a_1:checked~* .a_1{display:block;}-like css, and <label> tags to track state, show active containers, and catch clicks respectively.
using hidden radios is nice because the back/forward buttons often preserve form state, meaning your slideshow picks up where you left off, not at slide #1 each time...
using javascript can/wll improve the user interface on those widgets, and it's needed for compatibility with older versions of IE that don't understand CSS2.1/3, as well as to provide full assistive-technology accessibility to the CSS-styled content.
__________________ my site (updated 5/13) STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
He doesn't sound like he is one who is ready/able/willing to re-create all those widgets and plugins using non-JS coding.
he might not need to fully replicate them, but to "initialize and control" them, which makes sense for some but not all of the widgets. most jquery ui html markup can be extensively customized with css and html attribs.
i'm not sure what he wants, and it almost seems like one of those "how do i drive a car without an engine" questions, but it's worth pointing out that we don't NEED javascript for those UI patterns...
A hybrid approach, known as graceful degradation can use the server, CSS, and/or <noscript> to provide equitable functionality/access to interactive content in less-than-ideal client environments.
__________________ my site (updated 5/13) STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
If a widget doesn't work in a particular browser, then *YOU* will have to figure out how to change the code of the widget to make it work. Or rewrite the widget from the ground up to work in all browsers.
If a widget REQUIRES JavaScript to work, then OF COURSE it will not work in a browser that has JavaScript disabled.
If a widget is written using jQuery *OR* plain vanilla JavaScript, there is *NO WAY* to make it work in a browser than has JavaScript disabled.
How can we be any plainer than that?
If you want widgets that work when JavaScript is disabled, then YOU will have to write them. Or find them on the internet.
As was suggested to you, many "effects" that are done using JavaScript *can* now be done using only HTML5 and CSS. But now you have the problem that HTML5 and advanced CSS will not work on older browsers.
I really think that the short AND CORRECT answer to your question is still: NO.
If you have not understood the discussion that has taken place in this thread, then I really doubt you are capable of creating the "replacement widgets".
And I also doubt that you understand what you are asking for when you want to control front-end widgets with server-side JS. The ONLY way that server-side code can even know what is going on in a browser is for the browser to send an HTTP REQUEST to the server. And without JavaScript in the browser, the only ways for that to happen are (a) to submit a <form> back to the server or (b) click on an <a> link back to the server. (Just incidentally, both of these mean that the only human interaction that can cause a response is a mouse click or, for a <form> submit, the ENTER key.) Note that in BOTH these cases, without JavaScript involved, the *ONLY* thing the server can do is send a COMPLETE WEB PAGE back to the browser to REPLACE the current web page.
I truly don't think you understand what you are asking for. I think you need to go back and study just what HTML alone (meaning without JavaScript) can and can not do. The answer is: Not very much.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.