I didn't get a chance to read all of this, but I've got recommendations for "dynamic" javascript.
Try to separate the javascript into its own file accessible from the outside world. Be sure to add HTTP headers which indicate when the .js file was last modified and how often the cache should be refreshed. This will reduce the number of times the browser will hit the .js file, resulting in a faster page load time. Try to read the entire RFC 2616, but if you don't have the time, peek at these: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.15 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.18 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.29 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21 On 10/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, folks: > > Not sure if this is a right direction, I am hoping to use Mason to > control over a Javascript file where I need to adjust the background > color of some block level elements. The color value is changeable > according to different session_id. What I have done is: > > in .htaccess of my document root. > --- > ..... > AddType text/javascript .js > AddHandler mason-handler html css js > > and in my Javascript file example.js: > --- > ..... > var bkColor = <% $bkColor %> > ..... > ..... > <%init> > $r->content_type( 'text/javascript' ); > my $session_id = myweb_get_cookie('U'); > my $bkColor = $session{ $session_id }{ backgroundColor }; > </%init> > > in autohandler's <head /> section: > > <script language="javascript" type="text/javascript" > src="/lib/example.js"></script> > > The result is that all Javascript functions in "example.js" don't > work, and after I save the webpage, "example.js" is missing. so I > guess there is sometihng wrong with parsing JS file this way.. If I > remove 'js' from Addhandler directive in .htacess, the webpage can > work properly.. So I am guessing that I did something wrong with > parsing JS file with Mason.. Can anyone shed some light to me on how > to handle a stand-alone JS file with Mason?? I am using: > > HTML::Mason 1.36, mod_fastcgi/2.4.2, GNU/Linux 2.6.18-4-amd64. > > Many thanks for your time.. :) > > Regards, > Hao. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Mason-users mailing list > Mason-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mason-users > -- moo. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users