Using Javascript to load Flash.Because of the well known
Eolas patent issue regarding
Internet Explorer and users having to
click to activate Flash content a number of Javascript libraries has emerged to get round this problem e.g
swfobject,
UFO. The reason being that any
Flash content loaded up through script was not affected by this patent issue and the user did not have to click anything.
I along with many others implemented generic functions to get round the "click to activate" problem. However since
March of 2008 the issue has been resolved and current versions of Internet Explorer and any previous versions that have had patches applied to them
do not have this issue. Therefore I am wondering whether
there is any point in having Flash content delivered through Javascript rather than Server side code?The main reason for doing it this way has been removed and by using Javascript to load all
Flash you are
narrowing your user base. More and more users are
crawling the web with Javascript de-activated and I imagine that in this security conscious times we live in that this percentage
will only increase. Checking my logged traffic statistics for today I can see that
10% of my sites non crawler users have Javascript disabled so this is quite a large number of users that won't be able to see all those
Flash adverts and banners that your customers have paid £££ to place on your site.
Therefore in any new sites that I create I am reverting back to generating the
Flash HTML server side unless there is a need for client side user interaction such as when I use flash for text counters. I am using the same
XHTML that
SWFobject and others have started doing which checks the users browser type and outputs the relevant
OBJECT code accordingly i.e
classid and
codebase for
IE and
type for the others. This removes the need for
embed tags and is still
XHTML compliant plus its done
server side so there is no issue when users turn
Javascript off.
<object type="application/x-shockwave-flash" data="/images/Banner.swf" id="BANNER643" align="middle" width="468" height="60">
<param name="movie" value="/images/Banner.swf">
<param name="allowScriptAccess" value="sameDomain">
<param name="quality" value="high" />
<param name="wmode" value="transparent">
</object>
If the users browser is
Internet Explorer I output a
Javascript function call at the bottom of the page that will "
fix" any
OBJECT tags so that any users that don't have patched versions of
IE and so still ask the user to
"click to activate" will not have this problem as long as they have
Javascript enabled.
A simple version of the
EOLAS fix code is below although I am currently using a more advanced option that handles complex
OBJECT params alot better.
objects = document.getElementsByTagName("object");for (var i = 0; i < objects.length; i++){objects[i].outerHTML = objects[i].outerHTML;}
All my users should get this content and only the unpatched
Internet Explorer users who have
Javascript disabled will have the inconvenience of being asked to "
click to activate".
It would be nice to be able to
detect whether Internet Explorer users had patched or unpatched versions so that I could only
run the Javascript fix code if it was absolutely necessary but I cannot think of a way to determine this. I was thinking of maybe trying to access the first
flash movie on a page and check the
PercentLoaded property which must be unavailable if the
flash movie is unactivated. However using the
multiple IE version hack to run
IE 6, 5 etc you always get a pop up saying "
Press okay to continue loading content" when a page contains
Flash so I cannot test this out. Either way this seems the best way to code
Flash for the future as it ensures the maximum user coverage and still handles the
EOLAS patent problem for those
IE users who have not updated.
If anyone can think of any other reasons to be using
Javascript and limiting your user coverage then please let me know.