Embedding SWF file in HTML5 - How to add alternative content? - html

I'd like to embed an SWF file in HTML5. It works fine with this code:
<embed src="main.swf" width="550" height="400" />
But how could I show alternative content (an animated GIF image, or a static JPEG or PNG) just in cases which swf file is not supported (and still validating in w3! ;) )
Thank you!

Use the object tag instead of the embed tag like so:
<object width="550" height="400" data="main.swf">Alertnative Content Here</object>
See: EMBED vs. OBJECT

Related

Is it possible to use Ruffle within an Iframe?

So ive been trying to use Ruffle (a flash emulator written in Rust) on a website for some flash games. This works like a charm with flash games in my website source files, but it doesnt work for iframes. This is the code that ive been trying to get working, but at this point im not sure if its possible at all. any help?
<script src="ruffle/ruffle.js"></script>
<iframe id="cppscreatorCPPS" src="https://play.cppscreator.xyz/embed/24436" scrolling="no" width="960" height="600" frameborder=0></iframe>
<br /><br />```
Instead of an <iframe>, I would recommend you used an <object> and <embed>component. I will leave a code snippet below (You need to replace the value of the param and the src of the embed with your swf file link. In your case, it is the play.cppscreator.xyz/embed link. ). Also, you are using cppscreator.xyz, which does not really work, as it is not an SWF file.
<script src="https://flash-games.penguinbotcoder.repl.co/ruffle/ruffle.js"></script>
<object width="600" height="400">
<param name="movie" value="https://flash-games.penguinbotcoder.repl.co/flashgames/thinice.swf">
<embed src="https://flash-games.penguinbotcoder.repl.co/flashgames/thinice.swf">
</embed>
</object>

display src of html5 audio file

I have an app that uses tiny mce to embed audio files using html5 so it ends up embedding like this;
<audio width="300" height="32" preload="none" controls="controls" src="../upload/blah .MP3"></audio>
I would like to however show the name of the file under the player i.e. the src, any ideas of how it can be done?
I assume your audio file is embeded inside the tinymce content.
In this case the following should work
$('#target_id').html($(ed.getBody()).find('audio:first').attr('src'));

Place a Flash file (.swf) in GSP page-Grails

I need to include flash file in my grails app,in my view page.
Need some code regarding it.
Thanks in advance
Bhanu
You can use html object tag in your GSP
<object width="300" height="120" codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0">
<embed src="path-to-swf-file" width="400" height="40"></embed>
</object>

HTML alternative if plugin is not available

What is the best practice for displaying an HTML alternative when a browser plug-in is not available? I'm embedding the plugin with an object tag like so:
<object id="plugin0" type="application/x-myplugin"></object>
This is what an unknown plugin displays as in Google Chrome, however I'd like the solution to work on all browsers (i.e. FF plugin/Chrome plugin/IE ActiveX object)
-foot
If you're talking about flash, whatever you place within the object tag will show up if flash is not supported.
Here's an example of a flash movie with a fallback image:
<object type="application/x-shockwave-flash data="yourmovie.swf" width="400" height="300">
<param name="movie" value="yourmovie.swf" />
<img src="noflash.gif" width="200" height="100" alt="" />
</object>
I typically test for plugins using javascript and write to the page based on the test results.

How to let the embedded object use its natural size?

I'm using <object> to embed an SWF file like this:
<object width="900" height="900">
<param name="movie" value="carte-uso-ch-01.swf">
</object>
I don't know if this is portable and it really doesn't matter here, this is just for personal use. Is there any way to let the SWF expand to its actual size, instead of restricting it to 900x900? If I remove the width and height attributes from <object> I'll only get a thumb displayed.
If you have PHP running, you can use getimagesize() on SWF files.
<object width="100%" height="100%">
or JavaScript width andheight detection