HTML alternative if plugin is not available - html

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.

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>

Param Element in Object not working in Firefox

I have a very basic html page which takes a parameter to render a pdf file with the object tag. I was seeing this page work correctly in Chrome and IE but failing in Firefox. As a proof of concept I broke it down into an even simpler scenario which works in Chrome/IE and fails in Firefox.
<object width="100%" height="100%" type="application/pdf">
<param name="src" value="myFile.pdf">
</object>
However if I use something like the below block then it renders fine in all browsers. Any ideas why the example above wouldn't work in Firefox?
<object width="100%" height="100%" type="application/pdf" data="myFile.pdf">
</object>
It looks like the data attribute is the standard way of specifying the file. According to Mozilla's documentation the data attribute is required on the object tag.

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

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

How can I play a flv file that is hosted on a remote website?

I'm looking to play a flash video hosted on a remote website. I've tried the following (and profuse google-ing):
In source of page on http://fakesite1.com/player.jsp:
<embed src = "FlashPlayer.swf?file=http://fakesite2.net/video.flv" />
I can browse to http://fakesite2.net/video.flv and ensure it's there, but the player comes back "movie not loaded" (on right-click) on fakesite1. My initial guess is that this might be some sort of security feature... is it possible to play a video hosted on a remote site?
The message "Movie not loaded" as seen in the context menu of an SWF object in a webpage means that the .swf file was not loaded by the browser plugin. The main cause is that that SWF file doesn't exist and the plugin got a 404 error, in which case make sure that the path to the SWF file is correctly set.
Also, the <embed> element is obsolete in modern HTML. Use <object> instead, as seen below.
Note that various versions of IE (except IE9/10, possibly including IE8) do not support the HTML5 <object data="" /> element, they prefer the IE4-era <object clsid="" /> element, so use a conditional comment, like so:
<!--[if IE]>
<object width="640" height="480" data="http://mysite.com/myflash.swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" >
<![endif]-->
<!--[if !IE]>-->
<object width="640" height="480" data="http://mysite.com/myflash.swf" />
<!--<![endif]-->
Try;
<embed
src="player.swf"
width="300"
height="300"
allowscriptaccess="always"
allowfullscreen="true"
id="player1"
name="player1"
file="http://fakesite2.net/video.flv"
/>
Is your SWF file named exactly "FlashPlayer.swf"?
As far as I know in Windows based systems letter case differences don't matter, however in Unix or Linux based ones it does matter. Your host is probably a Linux one. Try using lower case letters like "flashplayer.swf". Make this a habit with files that will be hosted online all the time. Also no space or special characters, use - or _ to seperate words.

Fail to embed Flash by using Data uri scheme

i just want to embed a flash like this:
<object
data="data:application/x-shockwave-flash;base64,..."
type="application/x-shockwave-flash">
<param name="movie"
value="data:application/x-shockwave-flash;base64,..."
/> </object>
but it just doesn't work. Did i make any mistake?
thankz
That's because it doesn't work. Not only would you have a buffer overflow, but most browsers don't allow for the inclusion of Flash via Data URIs. If you need a good place to host your Flash, Google Code works just fine.