I have a JavaScript function that loads a flash movie into a webpage div using swfobject.embedSWF().
I want to be able to, alternatively, load a .mov file into the same div, in the event that this is the file found instead of the .swf.
Is there a close equivalent to swfobject.embedSWF for the purposes of embedding a .mov file? If not, what is an efficient route to doing this using JavaScript?
QTObject might do what you need and it's from the same author as SWFObject. It's old though, so I'm not sure if it will work well in modern browsers.
EDIT I searched and found reports of it working fine in IE7, Firefox 2 and Opera 9, so you might just be in luck. Just make sure you test it thoroughly.
Related
Developing Chrome Apps is a major pain in the ass because of all the restrictions. I've been trying to find some sort of way to embed a flash object inside it and I just can't do it.
Basically, it's an external flash object that you embed using inline javascript. And no I can't download the object or anything like that, because it receives data from the server.
If it matters this is what I'm trying to embed:
<script type="text/javascript">var zippywww="50";var zippyfile="30734813";var zippytext="#000000";var zippyback="#e8e8e8";var zippyplay="#232323";var zippywidth=850;var zippyauto=false;var zippyvol=80;var zippywave = "#000000";var zippyborder = "#cccccc";</script><script type="text/javascript" src="http://api.zippyshare.com/api/embed_new.js"></script>
And no I can't use anything else, because the player needs to play files from that host.
Flash is listed as a disabled web feature on the Chrome App developer site: https://developer.chrome.com/apps/app_deprecated. The suggestion is to use HTML5 instead.
Try putting that HTML into a webview. (Haven't tried it myself, but it might work.)
You can set the Flash plugin as "always allowed to run" in the Chrome settings and it seems to work well in my packaged app. The feature is supposed to be deprecated so I can make no guarantee about it, but it does work in practice for now.
I use the following jQuery code to access functions in my SWF (FP 10.1 SWF embedded via SWFObject):
$('#FlashApp')[0].someFunc();
This works fine in every browser.. except for Internet Explorer (surprise!). Surely, the point of jQuery is to make this code work across all browsers? I'd really rather not write extra code to check for IE.
How can I talk to my SWF in a browser independent way?
Dousn't sound like a jQuery problem. Try the following in IE to see if you get the same results:
document.getElementById('FlashApp').someFunc();
It turns out that the issue was due to IE not being able to talk to an invisible SWF.
you need External Interface
http://blog.flexexamples.com/category/externalinterface/
Is it possible to allow users to paste image data into a Website? That is, they have an image in the clipboard and can paste it into an HTML Site? (I would then somehow grab the bytes and store them - persistence isn't the problem here)
It needs to be Cross-Browser IE8, FF3.5 and Chrome 4, but I can use browser plugins like Silverlight, Flash or bare JavaScript if possible (I might even use Browser Plugins, although that would be painful to manage and IE would need ActiveX is guess...). Also since it's an internal site, I can add the site to the Local Intranet Zone in IE (not sure if that changes stuff for Firefox and Chrome).
Any chance to do this?
With Silverlight 4, you have text-only clipboard access, but not Image data, as far as I can remember...
Check out the lengthy discussion here. I think the end result was that this is possible using a combination of Canvas and Flash.
i was wondering if anyone knew a quick solution to my problem. I want to be able to open a folder on users screen pretty much the same as but just opening up the my computer folder so a user can drag a file onto the browser screen. anyone know how?
You can't. They even gave this bug a name: "security".
The closest you can get without using Flash, proprietary browser stuff or Java is something like this.
You have to use a java applet.
Javascript has no access to the file system for security reason.
Every page would be able to see the files on your local machine and might display: "According to the files on your disk you might be interested in some of our special movies ;)"
Incidentally, there are custom extensions in IE and Firefox that let you load and save files; it's the reason TiddlyWiki can work as it does. It does degrade a Java applet for other browsers.
A new jQuery plugin has been extracted out of TiddlyWiki to give Javascript authors the ability to load and save, and it's portable across all browsers:
twFile - http://jquery.tiddlywiki.org/twFile.html
It's quite possibly not what you're after as it will only work off a file:/// URL.
I don't want to use jQuery, but I'd like to use Ajax to do file uploading. Is that possible?
If so, where can I find information/tutorial on it?
No, it isn't possible to do this with javascript.
In order to give the 'AJAX' feel, however, you can submit a form to a hidden iframe and output the script results to it, then process from there. Google ajax iframe upload and get started from there.
If you are using jQuery, there is also the Form plugin which will automatically create this iframe for you if your form has any file fields in it. I haven't used it to do this, but I've heard good things.
As pointed out in the comments, you can also use something like the very popular SWFUpload to accomplish the desired effect with Flash.
Incase anyone is finding this question much later: yes this is possible with JavaScript now.
HTML5 defined 2 new APIs that you use together to accomplish this: Drag and Drop API and the File API. You can use jQuery to interact with the APIs effectively letting people drag and drop files for upload.
Here is a tutorial on how to do it.
The code currently works in Chrome 6+ and Firefox 3.6+, Safari 6 and IE 10. If you need Safari 5 support, the code stays almost exactly the same but you use the FormData object instead for the uploaded file list (more information in the post).
Opera supports the File API as of 11, but not the DnD API, the drop operation does not initiate the upload, but they support you getting access to the file with the API. I imagine in 12 they will finish off support for DnD API.
01-20-14 Update: All the major browsers implement all the standard APIs now so this tutorial works in all browsers.
i use swfupload for multiple ajax-like uploads (its javascript/flash based)
Here's a bit of detail about how gmail does it, using an iframe:
http://www.sajithmr.com/upload-files-like-gmail/
Assuming you are using Java, DWR version 3.0 (currently in RC1) has support for binary file upload/download, which makes the problem trivially easy. I have not had a chance to try this out yet but we use DWR extensively with total success; it is a great Ajax toolkit.
http://directwebremoting.org/blog/joe/2008/12/16/dwr_version_3_0_release_candidate_1.html
Strictly speaking there are possibilities to do real AJAX file uploads, but this is only possible in Firefox 3+, Safari 4 and Chrome 2. In all other browsers you must use a workaround like the iframe technique or a Flash based uploader.
Haven't used it personally, but Ajax Uploader is a component I recently came across which says it can do file uploads inside an UpdatePanel (assuming you're using ASP.NET).