LuisNeighbur / swfobject

Automatically exported from code.google.com/p/swfobject
0 stars 0 forks source link

Allow for degregation to be optionally disabled to invoke the default browser plugin-installation prompts #565

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This is an enhancement request which is based on this thread in the forums:
http://groups.google.com/group/swfobject/browse_thread/thread/2861fe92bb9b63ca#

I understand that graceful degradation of Flash content is one of the 
cornerstones of SWFObject and I agree that it should continue be the default 
behavior of SWFObject.  

However, some uses of SWFObject are to embed content which can only be played 
via Flash (no alternative content exists) and in some scenarios it is desirable 
for the user to be prompted to install Flash if it is indeed a requirement for 
using the page.  

SWFObject already provides the mechanism by which I can unable the express 
Installer to check for a specific version of Flash and prompts the user to 
upgrade their plugin.  I would like to suggest that is taken one step further 
and an optional setting is added which would allow the developer the choice 
between degrading to alternative content or allowing the browser’s default 
behavior to happen (prompting/installing automatically in major browsers) in 
the instances where Flash is explicitly required, the user is aware of that 
fact, and the page is useless without it.  

SWFObject is an excellent library for cross-browser embedding not all 
developers using it are as interested in degradation as they are making it as 
easy and seamless as possible for the end-user to get Flash so they can view 
the page.  I think placing the decision of whether to degrade or prompt in the 
hands of the developer makes SWFObject more versatile and preserves its 
usefulness as a general-purpose SWF embedder.

Thanks!

~Brad

Original issue reported on code.google.com by bdw4...@gmail.com on 16 Jun 2011 at 8:56

GoogleCodeExporter commented 9 years ago
Sorry for entering this as a defect instead of an enhancement.  Sadly, the new 
issue form did not allow me to choose an issue type.

Original comment by bdw4...@gmail.com on 16 Jun 2011 at 8:58

GoogleCodeExporter commented 9 years ago
I understand your request, but this functionality is already possible with the 
existing SWFObject codebase.

You can use createSWF instead of embedSWF to perform more targeted embeds.  If 
you don't care about version targeting and want SWFObject to ALWAYS embed the 
SWF, regardless of version found (even if Flash Player isn't installed), you 
can simply use swfobject.createSWF. You can also use embedSWF but specify "0" 
for required Flash Player version; SWFObject will write the <object> to the 
page, and you'll have to depend on your browser's native functionality to 
handle the rest.

On a similar note, if you use static publishing and don't care about version 
targeting, you can simply omit swfobject.registerSWF and let the browser handle 
the visitor's lack of Flash Player. (I see Kyle covered this in his email on 
the SWFObject Google Group thread)

There are many ways to handle this task, and the current SWFObject library 
should meet your needs.  It really depends on how you use it.  Also, if you're 
using a jQuery plugin that harnesses SWFObject, that's out of our hands. Please 
see the plugin creator about modifications.

Thanks for the input.

Original comment by platelu...@gmail.com on 16 Jun 2011 at 10:00

GoogleCodeExporter commented 9 years ago
Thanks for the additional information.  It seems your work arounds all involve 
not needing version targeting and/or using static publishing.

Is the desired outcome still available if I am using dynamic publishing AND 
need to target a specific version of Flash?

Original comment by bdw4...@gmail.com on 16 Jun 2011 at 10:09

GoogleCodeExporter commented 9 years ago
Yes, but with one huge caveat: each browser behaves differently, and if the 
browser doesn't support installing the plugin, the fallback (aka "alternate") 
content WILL NOT BE VISIBLE.

Here's an example:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Simple dynamic publishing</title>

<!-- Loading SWFObject from the Google repository; only works if you have an 
internet connection! -->
<script type="text/javascript" 
src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>

<script type="text/javascript">

var target_version = "10";
var flashvars = {};
var params = {};
var attributes = {};
var playerVersion = swfobject.getFlashPlayerVersion();

//If no Flash Player, (or Flash Player is so outdated it doesn't support 
ExpressInstall),
//embed using codebase and pluginurl options
if(playerVersion.major === 0 || playerVersion.major === 6 && 
playerVersion.minor === 0 && playerVersion.release < 65){

   alert("You don't have Flash. Let's get the browser to prompt you to install the plugin.");

   target_version = "0";

   if(swfobject.ua.ie){
      //For Internet Explorer
      attributes.codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";
   } else {
      //For all other browsers
      params.pluginurl = "http://www.adobe.com/go/getflashplayer";
   }

} else {

   alert("You have Flash. We'll let SWFObject handle version checking. ExpressInstall will prompt you to upgrade if you have an outdated version of Flash Player.");

}

swfobject.embedSWF("swfobject.swf", "flashcontent", "550", "400", 
target_version, "path/to/expressinstall.swf", flashvars, params, attributes);

</script>

</head>

<body>
<div id="flashcontent">This fallback content will only be seen by visitors who 
have JavaScript disabled.</div>
</body>
</html>

Original comment by platelu...@gmail.com on 17 Jun 2011 at 4:14