
i think the script part should be something like <script language='javascript'> and you also need to call the function for it to work... On Mon, Nov 15, 2010 at 11:13 AM, ndungu stephen <ndungustephen@gmail.com> wrote:
Hi fellow skunkers; I was looking at the "view-code" of the apple website "http://www.apple.com/" and i noted a JScript called "browser_detect.js" ;; Which I guess helps the site detect what sort of browser the client is using and serves the right content e.g "http://developer.garmin.com/web/communicator-api-0.5/jsdocs/overview-Browser..." However, the script shown seems to just detect the browser; so I guess there is more to be done for cross-browser support.
My question is; how do you make code like this work across the common browsers (used as an example) : chrome, mozilla, internet explorer, opera mini etc The code below only seems to work fine with Internet explorer; the alert box pops up fine only on IE; but not chrome or mozilla (I just hope its not a Vista problem) =============== save as php or any relevant extension and serve from your Apache or any other program ============== <HTML> <HEAD> <TITLE>Cross Browser alert</TITLE> <SCRIPT> M=false; N=false; app=navigator.appName.substring(0,1); if (app=='N') N=true; else M=true; function go() { if (M) alert(Pred.style.color); if (N) alert(document.ids['Pred'].color); } </SCRIPT> </HEAD> <BODY onload="go();"> <P ID="Pred" STYLE="color:red">This is Red</P> </BODY> </HTML> ==== Question again: Are there standard scripts like the "browser_detect.js" shown above that one can adapt to their web/wap site for cross-browser support (cos it seems each browser demands different methods to execute the JScripts successfully) ?? (yes, and I have googled, I dint come up with anythin substantial :) Any help or direction would be much appreciated.
Thanks.
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke