[Zope] Check for JavaScript:

TMGB bennettt@am.appstate.edu
Thu, 02 Nov 2000 14:29:53 -0500


To expand on Peterson's idea, this is what I've used to test java script
and cookies.  Instructions at the top of the page instruct the user to
reload to get accurate readings (for cookies) see:
http://linux.library.appstate.edu:8080/Zope_Server/Forms/SAAT/Proxy/
A page I'm working on to trouble shoot user problems when using our
library proxy service.  There is a hidden input in the if statement of
the javascript, I have not tested to see if it sets that value every
time the page loads or not anyway.  One problem with the trouble
shooting page is user's cache settings and when to reload pages.  The
actions for the submit buttons have not been created yet.

<tr>
   <td>
      <b>Are Cookies enabled:</b>
         <dtml-if expr="RESPONSE.setCookie('uname','test', expires=
(ZopeTime() + (1.0/102.0)))"></dtml-if>
   </td>
   <td valign=bottom>
      <dtml-if "REQUEST.has_key('uname')">
         <FONT COLOR='GREEN'><b>YES, You Do Have Cookies Enabled</b>
         <input type=hidden name=cookieyes value=t size=24>
      <dtml-else>
         <FONT COLOR='RED'><b>NO, Your browser is not accepting
cookies</b>
         <input type=hidden name=cookieyes value=f size=24>
      </dtml-if>
   </td>
  </tr>
<tr>
  <td>
    <b>Is Javascript enabled:</b>
  </td>
  <td valign=bottom>
    <noscript>
    <FONT COLOR="RED"><B>NO, Your browser is not Javascript
enambled</B><br>
    Proxy resources require JavaScript.</FONT>
    </noscript>
    <script language="JavaScript">
    document.cookie="Test=Success"
    cookieString=document.cookie;
    if (cookieString.indexOf("Test=Success") != -1) {
       document.write("<FONT COLOR='GREEN'><B>YES, You Do Have
Javascript enabled</B></FONT><input type=hidden name=javayes value=t
size=24>");}
    </script>
  </td>
  </tr>

Thomas

PS. Is there a way to read the client's proxy setting directly?


Daniel Rusch wrote:
> 
> Hey all,
> 
> Is there a way from zope to check to see if a user has Javascript
> enabled????
> 
> Thanks,
> 
> Dan
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

-- 
--------------------------------------------------------------------
                      Rock and Rule
             Zope Rocks -- http://www.zope.org
           Python Rules  -- http://www.python.org    
--------------------------------------------------------------------
Thomas McMillan Grant Bennett      Appalachian State University
Computer Consultant III            University Library
bennettt@am.appstate.edu          
http://www.library.appstate.edu/webmaster/
Voice:  828 262 6587	           FAX:    828 262 3001

Windows 95 is a 32-bit extension to a 16-bit patch for an 8-bit
operating system that was originally coded for a 4-bit microprocessor.
 - Chris Dunphy     Boot Magazine