I'm writing what is essentially a browser in Adobe AIR (ActionScript, not AJAX). A great bit of functionality to implement would be protocol handling. iTunes, for instance, handles itms protocols; when your friend sends you a link beginning with "itms://", it's going to launch iTunes as long as it's installed. Is there a way to write an AIR app (requiring AIR 2 would be fine) that can be the "handler" for a protocol in this way?
There is no way, programatically speaking, to specifically handle a particular protocol. However, there is InvokeEvent. InvokeEvent will be fired when the application is "invoked", either when it's explictly launched or if an associated file or URL is activated.
The process of associating your app with a particular file type or protocol scheme is separate and application-dependant. In iOS, for example, you would need to specify the protocol in Info.plist under CFBundleURLTypes/CFBundleURLSchemes.
Yes. You can use the URLLoader class to download data in binary form (URLLoader.BINARY) and then parse this as appropriate. See this CS3 documentation on working with external data.
http://www.patrick-heinzelmann.de/labs/lastfm/
I'm not sure exactly how it works and I don't see a way to download the app, so I can't even test it, but maybe it will help...
Check out this page. I am trying to find out the same thing, but I haven't found any solution to do it with just Air yet. Seems like you might need a custom installer to setup the correct registry entries, and a proxy application to "wash" the input to a correct format that then can start your application with the correct command line parameters. Hope this can be of any assistance.
Related
I want to transfer information from my website to my electron program by using a link that has some data in it (like myprogram://data). But can't seem to find any info on the internet about this. Any help would be gladly appreciated.
Thanks!
You need to register your app as a protocol handler using app.setAsDefaultProtocolClient
app.setAsDefaultProtocolClient("myprogram")
On Windows, when the "myprogram://data" link is clicked, a new instance of your application will be launched and the arguments will be included in process.argv
Use app.requestSingleInstanceLock if you don't want multiple instances of your app to be running
On macOS, you can get the arguments using the open-url event
Basically, I'm creating a webpage filled with images of movie posters that link to video files, as a means of making a more visually-appealing form of my local video library.
I'm using
<a href="C:\blah\movie.mkv"><img src="poster.jpg">
It works exactly how I want, HOWEVER, it opens the file in the browser rather than opening it in its default program, as I would like. I would like each link to open the file in the program titled "VLC Media Player", as specified in Windows for each of their filetypes.
Let me know how I can do this (in the simplest form--I'm not too smart :P)
Thanks!
If you are creating web pages on your local system for you own use then you may want to consider looking in to a WAMP server setup. This uses php and should allow you to call VLC using the exec command. Would take some learning however.
There is very little you can do to control how a client will handle a resource.
You can use the Content-Disposition HTTP response header to state that the resource is an attachment (and thus recommend that it be downloaded instead of opened).
Content-Disposition: attachment;filename="movie.mkv"
You can't, however, stop browser native support or a plug-in from handling something instead of having it open in a separate application (let alone cause it to be opened in a specific application).
If the browser is configured to open video files internally, then nothing the author of a website can do will make it switch to using a application instead.
I am using $_SERVER['HTTP_USER_AGENT'] to return the user's OS and browser when uploads are successfully completed using uploadifive. I have to use a flash fallback for browsers that don't yet support HTML5, i.e. the script falls back to uploadify. After successful uploads I have a script which submits data to a MySQL database, including the OS and browser. This works fine with uploadifive, but for uploadify 'Adobe Flash Player 11' is returned. I am wondering if there is a workaround to return the OS and browser when using flash?
Thanks
Nick
Yes and no. If the user is interested in not providing this information to you, you will not get it. But if they don't care / would like to provide it, then you can do it through http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/#!flash/system/Capabilities.html os property. You can also query JavaScript through ExternalInterface for navigator.
However, in general, Flash may send requests all by itself, i.e. being the user agent, not needing other user agents.
These headers are generated by the client-side software, which inherently cannot be trusted. Nothing can prevent the user from sending whatever information with the request. So, by handling the particular case of Flash not sending something you expect you aren't fixing the problem, you should be ready to have just any random information in that field, or, maybe, none at all.
Can someone please explain what does the following line of code exactly do? If I were to build my own Unity3D that exports a similar kind of applications for the browser, what should I do? E.g. should I register somewhere the type of these applications?
<embed type="application/vnd.unity" src="webplayer.unity3d">
This line belongs to this website http://unity3d.com/gallery/live-demos/index.html#bootcamp and is usually encountered for browser applications that have to use native computer resources. These apps are not Flash nor Javascript.
If I wanted to do that for my own software what process should I follow?
If someone could shed some light on that, it would be much appreciated!
The <embed> tag is used for adding applets to a page and is specific to Mozilla browsers.
The attributes of the tag depend on what exactly is being embedded (and because of this it's not included in HTML standards). In a Java applet for example, the version of the JRE that supports the MIME type defined in type will be used to run your applet.
The src attribute indicates the location of a file located somewhere other than the webserver (for example, downloaded by the user as a plugin) that is needed to run your applet.
Essentially, the tag indicates that the embedded file is a Unity app and once the user installs the plugin, will require the Unity 3D web player to launch. The link in the first part of this post has some examples for embedding Java apps (including how to do so and support other browsers), and the process is not dissimilar for other types of apps.
This is a MIME type indeed and for someone to use it for his or her own program a new MIME type should be registered which seems from the outside a long bureaucratic procedure. The way to do that can be found here: http://www.rfc-editor.org/rfc/rfc2048.txt
I have a Java applet related problem and I would appreciate your help. Here's the story:
I tried creating an applet, that would try to connect to digg.com and by using it's API, show the 100 most popular stories (also include some options to sort and filter the results).
Anyway, the applet opens and shows the GUI just fine in the browser, but when I press the button that loads the news, it won't load them, BUT the news are loaded, when I run the applet in Eclipse.
I thought, that maybe the problem is related to creating the runnable jar from eclipse, since I have some referenced libraries (Google GSON for handling JSON from digg.com). Here are the settings I used for creating the runnable jar (I also tried "Package required libraries into generated JAR):
http://img816.imageshack.us/img816/417/exportjar.png
Here's a picture of the applet (ran from eclipse), when the news have been loaded:
http://img841.imageshack.us/img841/9121/applet.png
I would appreciate any ideas on how to get loading the news to work in the web browser.
I think torah is right. Applets should be able to connect only to their own server. You can try and trick the browser, sending request back to your server asking it to retrieve the data and to return it to applet.
What happens when you attempt to open the connection to digg? Is there a security exception? I wouldn't be surprised to learn that the JVM inside the browser was implementing a same origin policy. If this is the case there should be some kind of Exception (SecurityException I think) being raised when you try to connect to digg.com.
A quick search for "same origin policy java" found the following article which both seems to confirm that this could be your problem.
http://www.zdnet.com/blog/security/defeating-the-same-origin-policy-part-1/946