millerthegorilla Posted September 30, 2008 Share Posted September 30, 2008 Hi - I am *very* new to php and am trying to insert a line of javascript into script tags in the body of an html page. Basically, I'm trying to detect the browser type and insert a flash param if the browser is firefox and a different one if not. Below is my php : function detect_transparent() { global $ff, $others; $browser = get_browser(); if($browser->browser == 'Firefox') { echo($ff); } else { echo($others); } and here is a section of the script tags in the html : <script> var so = new SWFObject('<?php swfaddress_resource('/website.swf?datasource=datasource.php'); ?>', 'website', '100%', '100%', '9,0,115,0'); <?php detect_transparent(); ?> so.addParam("allowFullScreen", "true"); ... </script> I know I could use a javascript function to do the same thing but I'd prefer to use php. The reason I'm doing it is because Firefox freaks out and takes up 99% of the processor when you use flash with wmode = transparent. The code works fine without the <?php detect_transparent(); ?> function call. Am I correct in thinking that a php function call like this gets executed server side and then the resulting html page gets passed to the client browser where the client side javascript is called? If that's right, why does this not work? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.