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.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Jul 2011
    Location
    India
    Posts
    496
    Thanks
    3
    Thanked 57 Times in 56 Posts

    Question 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.

    Thanks in advance :-)
    Vikram

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    are you asking how to make them work without javascript? JS has to be enabled for them to work properly, no way around that one.

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Quote Originally Posted by vikram1vicky View Post
    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.
    Have a look at

    http://www.codingforums.com/showthread.php?t=271898

    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.

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,373
    Thanks
    11
    Thanked 591 Times in 572 Posts
    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 13/9/26)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,901
    Thanks
    79
    Thanked 4,422 Times in 4,387 Posts
    Notice the one important thing he said:
    I want to use JavaScript widgets/plugins from any JS library (YUI, jQuery, MooTools, etc.,..)
    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.

    So doesn't that mean the short--and almost surely correct for his circumstances--answer is simply "NO"??
    Last edited by Old Pedant; 12-28-2012 at 09:48 PM.
    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.

  • #6
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,373
    Thanks
    11
    Thanked 591 Times in 572 Posts
    Quote Originally Posted by Old Pedant View Post
    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 13/9/26)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%

  • #7
    Regular Coder
    Join Date
    Jul 2011
    Location
    India
    Posts
    496
    Thanks
    3
    Thanked 57 Times in 56 Posts
    Thank you all for your inputs and I am sorry if I was not able to convey you properly, what are my questions.

    My question are ....

    Is there any way to make these widgets working in non-JS borwsers ranging from IE6 to latest Chrome and all mobile browsers?

    Is there any way to control front-end widgets from server-side JS ?

    My client wants to make widgets working in all browsers, new or old, JS enabled or disabled

  • #8
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,901
    Thanks
    79
    Thanked 4,422 Times in 4,387 Posts
    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.


  •  

    Posting Permissions

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