Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Not a Problem
    • Affects Version/s: SVN trunk
    • Fix Version/s: None
    • Component/s: framework
    • Labels:
      None

      Description

      Not depend on the javascripEnabled=Y parameter passed from the login URL (it's stored in the session) to determine if we use javascript or not. But to use jQuery cookie plugin to test if we can create a cookie, else we know that javascrip is not available

        Activity

        Hide
        Jacques Le Roux added a comment -

        I think it's possible using http://download.oracle.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html#evalfile? We need to load jQuery and the cookie plugin before. So we would need to have the last jquery version concatened with the last version of the cookie plugin (we have them at hand) and after an expression like jQuery.cookie("javascripEnabled", "just testing",

        { path: '/' }

        concatened. It should work, we have then to test if the cookie has just been created.

        Seems doable, to be revisited...

        Show
        Jacques Le Roux added a comment - I think it's possible using http://download.oracle.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html#evalfile? We need to load jQuery and the cookie plugin before. So we would need to have the last jquery version concatened with the last version of the cookie plugin (we have them at hand) and after an expression like jQuery.cookie("javascripEnabled", "just testing", { path: '/' } concatened. It should work, we have then to test if the cookie has just been created. Seems doable, to be revisited...
        Hide
        Adrian Crum added a comment -

        Jacques,

        How would this method be any different than the one we use now? You're still running a script that works only when JavaScript is enabled.

        Show
        Adrian Crum added a comment - Jacques, How would this method be any different than the one we use now? You're still running a script that works only when JavaScript is enabled.
        Hide
        Jacques Le Roux added a comment -

        Now it's arbitrary, it's set on an URL when login but does not determine really if javascript is enabled (usable actually) or not.

        The code is (LoginWorker.login[450...])

        // check on JavaScriptEnabled
        String javaScriptEnabled = "N";
        if ("Y".equals(request.getParameter("JavaScriptEnabled"))) {
            javaScriptEnabled = "Y";
        }
        

        With the change above, we will now if we can really use javascript or not (test: can we create a cookie using javacscript and check it's there locally still using javascript). BTW there is maybe an easier way than creating a local cookie, just a quick test with an exception?

        Show
        Jacques Le Roux added a comment - Now it's arbitrary, it's set on an URL when login but does not determine really if javascript is enabled (usable actually) or not. The code is (LoginWorker.login [450...] ) // check on JavaScriptEnabled String javaScriptEnabled = "N" ; if ( "Y" .equals(request.getParameter( "JavaScriptEnabled" ))) { javaScriptEnabled = "Y" ; } With the change above, we will now if we can really use javascript or not (test: can we create a cookie using javacscript and check it's there locally still using javascript). BTW there is maybe an easier way than creating a local cookie, just a quick test with an exception?
        Hide
        Jacques Le Roux added a comment -

        We will then be able to inform the user about it by a way or another

        Show
        Jacques Le Roux added a comment - We will then be able to inform the user about it by a way or another
        Hide
        Jacques Le Roux added a comment -

        Ha sorry, I did miss this snippet in login.ftl, you mean ?

        <script language="JavaScript" type="text/javascript">
          document.loginform.JavaScriptEnabled.value = "Y";
          <#if focusName>
            document.loginform.USERNAME.focus();
          <#else>
            document.loginform.PASSWORD.focus();
          </#if>
        </script>
        

        But then I wonder why I had to put in into my local login URL to have javascript always correctly working and also why it's on the OFBIz main site URL to trunk demo which is
        https://demo-trunk.ofbiz.apache.org/catalog/control/login/main?USERNAME=flexadmin&PASSWORD=ofbiz&JavaScriptEnabled=Y

        Show
        Jacques Le Roux added a comment - Ha sorry, I did miss this snippet in login.ftl, you mean ? <script language= "JavaScript" type= "text/javascript" > document.loginform.JavaScriptEnabled.value = "Y" ; <# if focusName> document.loginform.USERNAME.focus(); <# else > document.loginform.PASSWORD.focus(); </# if > </script> But then I wonder why I had to put in into my local login URL to have javascript always correctly working and also why it's on the OFBIz main site URL to trunk demo which is https://demo-trunk.ofbiz.apache.org/catalog/control/login/main?USERNAME=flexadmin&PASSWORD=ofbiz&JavaScriptEnabled=Y
        Hide
        Adrian Crum added a comment -

        The script in the login screen is what I was referring to. If JavaScript is turned off, the JavaScriptEnabled field will not be set to "Y". It's an easy way to determine if JavaScript is enabled.

        If a user has JavaScript enabled, then "JavaScriptEnabled=Y" will be added to the login request URL. That is why you need to include it in any URL that bypasses the login screen.

        Setting a cookie and then testing its existence is another way to do the same thing, but It's not any easier.

        Show
        Adrian Crum added a comment - The script in the login screen is what I was referring to. If JavaScript is turned off, the JavaScriptEnabled field will not be set to "Y". It's an easy way to determine if JavaScript is enabled. If a user has JavaScript enabled, then "JavaScriptEnabled=Y" will be added to the login request URL. That is why you need to include it in any URL that bypasses the login screen. Setting a cookie and then testing its existence is another way to do the same thing, but It's not any easier.
        Hide
        Jacques Le Roux added a comment -

        Ho, I think I know why now (though I was not able to reproduce). I was logging using this URL https://localhost:28443/catalog/control/login?USERNAME=admin&PASSWORD=ofbiz, so I guess maybe I was bypassing the login screen hence the JavaScriptEnabled initialisation...

        Forget it

        Show
        Jacques Le Roux added a comment - Ho, I think I know why now (though I was not able to reproduce). I was logging using this URL https://localhost:28443/catalog/control/login?USERNAME=admin&PASSWORD=ofbiz , so I guess maybe I was bypassing the login screen hence the JavaScriptEnabled initialisation... Forget it
        Hide
        Adrian Crum added a comment -

        I agree that it would be helpful to let the user know they will have a better experience if JavaScript is enabled. That information and other helpful tips could be in a Help page that is accessed via the Help link on the Login page.

        Show
        Adrian Crum added a comment - I agree that it would be helpful to let the user know they will have a better experience if JavaScript is enabled. That information and other helpful tips could be in a Help page that is accessed via the Help link on the Login page.
        Hide
        Jacques Le Roux added a comment -

        So we need to create a specific Help link on the login screen (because the Online Help needs javascript) . Can we simply put a small sentence there? and maybe in the header or footer (if javascript is disabled else nothing)

        Show
        Jacques Le Roux added a comment - So we need to create a specific Help link on the login screen (because the Online Help needs javascript) . Can we simply put a small sentence there? and maybe in the header or footer (if javascript is disabled else nothing)
        Hide
        Adrian Crum added a comment -

        Actually, that Help link needs its own Jira issue. You can't view the Help page without being already logged in. Plus, it would preferable if JavaScript wasn't required to get basic help when logging in.

        Show
        Adrian Crum added a comment - Actually, that Help link needs its own Jira issue. You can't view the Help page without being already logged in. Plus, it would preferable if JavaScript wasn't required to get basic help when logging in.
        Hide
        Jacques Le Roux added a comment -

        Adrian,

        It's not really about "better experience". We should warn them that w/out js they will not be able to achieve some of their goals. There are 444 calls of <a href="javascript: in FTL files. Not all are mandatory (for instance you don't need a lookup to fill a field, same for calendar). But I doubt that in certain cases you can seriously do it without lookups for instance. For security reasons there are 248 actions which needs javascript: in FTL files (ie javascript is mandatory for those actions to work). Just look for <a href="javascript:document. in *.ftl...

        There are 1353 occurences of the word javascript at all in FTL files, 343 in XML files but there I think it's rarely mandatory.

        So I really think it's now wishful thinking to hope using OFBIz w/out js enabled...

        Show
        Jacques Le Roux added a comment - Adrian, It's not really about "better experience". We should warn them that w/out js they will not be able to achieve some of their goals. There are 444 calls of <a href="javascript: in FTL files. Not all are mandatory (for instance you don't need a lookup to fill a field, same for calendar). But I doubt that in certain cases you can seriously do it without lookups for instance. For security reasons there are 248 actions which needs javascript: in FTL files (ie javascript is mandatory for those actions to work). Just look for <a href="javascript:document. in *.ftl... There are 1353 occurences of the word javascript at all in FTL files, 343 in XML files but there I think it's rarely mandatory. So I really think it's now wishful thinking to hope using OFBIz w/out js enabled...

          People

          • Assignee:
            Unassigned
            Reporter:
            Jacques Le Roux
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development