I need help with a JS function that was generated by Flash CS3. I am trying to output alternate content in HTML using a combination of JavaScript and PHP. The <noscript> portion of the code works, but the Flash version detection JS doesn’t work properly.
[B]The original output for non-flash is as follows:
[code]
} else { // flash is too old or we can’t detect the plugin
var alternateContent = ‘Alternate HTML content should be placed here.’
+ ‘This content requires the Adobe Flash Player.’
+ ‘<a href=http://www.macromedia.com/go/getflash/>Get Flash</a>’;
document.write(alternateContent); // insert non-flash content
}
}
// –>
</script>
<noscript>
// Provide alternate content for browsers that do not support scripting
// or for those that have scripting disabled.
Alternate HTML content should be placed here. This content requires the Adobe Flash Player.
<a href=”http://www.macromedia.com/go/getflash/”>Get Flash</a>
</noscript>
[B]I’ve modified the code to look something like this:
[code]
} else { // flash is too old or we can’t detect the plugin
var alternateContent = ‘<?php echo file_get_contents(‘/web/content/news-noflash.php’); ?>’
document.write(alternateContent); // insert non-flash content
}
}
// –>
</script>
<noscript>
<?php # Load the content
@include(‘/web/content/news-noflash.php’);
?>
</noscript>
[B]In this example, I would get the following output in the source:
[code]
} else { // flash is too old or we can’t detect the plugin
var alternateContent = ‘
<h2>What’s New</h2>
<p><a href=”/blog/”>Go to News</a></p>
<p><strong>NOTE:</strong> This is where our Flash News feed loads. We are making an XML / HTML feed to load in the event you don’t support Flash and Javascript. We apologize for the inconvenience.</p>document.write(alternateContent); // insert non-flash content
}
}
// –>
</script>
<noscript>
<h2>What’s New</h2>
<p><a href=”/blog/”>Go to News</a></p>
<p><strong>NOTE:</strong> This is where our Flash News feed loads. We are making an XML / HTML feed to load in the event you don’t support Flash and Javascript. We apologize for the inconvenience.</p></noscript>
[B]In the browser, the Flash won’t appear at all.