Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-09-2013, 07:15 PM   PM User | #1
soudin
New to the CF scene

 
Join Date: Jan 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
soudin is an unknown quantity at this point
How to make SWF work in all Browsers?

I would like for my flash content to be viewable on all browsers. All files on the server are in the right paths and locally everything works fine so it must be a browser issue. Here is the file...any help would be great...thanks!

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Susan Brewer's Art Gallery</title>


</head>
<body bgcolor="#000000">
<div id="flashcontent"><strong><strong>This content requires Flash Player 9 (or a more recent version).</strong></strong><noscript>Make sure JavaScript is turned on.</noscript><strong>You need to <a href="http://www.adobe.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash" target="_blank"> <span style="text-decoration: underline;">upgrade your Flash Player</span></a></strong></div>
<table height="100%" width="100%">
<tbody>
<tr>
<td align="center" valign="middle"><!-- normal object code in here - make sure to set a width and height -->
<div id="DivChainGalleryFX" align="justify"></div>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">// <![CDATA[
var flashvars = {};
var params = {};
params.base = "";
params.scale = "noscale";
params.salign = "tl";
params.wmode = "transparent";
params.allowFullScreen = "true";
params.allowScriptAccess = "always";
swfobject.embedSWF("ChainGalleryFX.swf", "DivChainGalleryFX", "1000", "800", "9.0.0", false, flashvars, params);
// ]]></script>
</td>
</tr>
</tbody>
</table>
</body>
</html>
soudin is offline   Reply With Quote
Old 01-09-2013, 08:30 PM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,528
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Flash will never work in all browsers because not everyone installs Flash in their browser plus some of those who do have it set to not run except when they tell it to so that it will only run on the few pages that they have decided to specifically allow it to run on.

Then there are those who don't have JavaScript or who have it turned off - although most of these will not have Flash either.

A single object tag is sufficient to attach Flash to web pages so that it will work in all browsers that have it available - with no JavaScript required. All the messing about was required for IE6 running old versions of Flash.

Just specify all the required parameters in param tags.

Code:
<object data="ChainGalleryFX.swf"
 width="1000" height="800" type="application/x-shockwave-flash">
 <param name="src" value="ChainGalleryFX.swf">
 <param name="quality" value="high">
 <param name="bgcolor" value="#FFFFFF">
 <param name="wmode" value="transparent">
 <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer">
 content for browsers that don't support flash go here
 </object>
You only need to use swfobject.js if you want to make sure that those without JavaScript cannot see the Flash even if they do have Flash installed.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 01-10-2013, 05:06 PM   PM User | #3
soudin
New to the CF scene

 
Join Date: Jan 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
soudin is an unknown quantity at this point
Thank you but one more question :)

what do you mean in line six of your code by "content goes here for browsers that don't support flash? Sorry...I am new to .js so I am a bit confused...should I replace the code you provided with mine in my html file? Thanks again...I appreciate the help.

Sarah
soudin is offline   Reply With Quote
Old 01-10-2013, 10:02 PM   PM User | #4
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,528
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by soudin View Post
what do you mean in line six of your code by "content goes here for browsers that don't support flash?
Sarah
Not everyone has flash installed in their browser - those that have the object tag execute while those that don't have whatever HTML that you put in place of that text appear instead.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:46 AM.


Advertisement
Log in to turn off these ads.