views:

71

answers:

3

Amazon has the button that opens an app as follows.

Clicking this button opens a 'Amazon Kindle', for my case, 'Amazon Kindle for Mac'.

How is this possible? I mean, how can I program to do this job? It's definitely not Flash.

I tried to use button to open an App using button provided by HTML, but I couldn't make it because of the security kind of reasons.

ADDED

This is the source code for it.

<tr><td><a href="kindle://home/?action=refresh"><img src="https://images-na.ssl-images- amazon.com/images/G/01/kindle/www/mazama/download/mac/go-to-kindle-for-mac-lg-pri._V192549350_.gif" border="0"></a></td></tr>
<tr><td><div style="font-size:11px; margin-top:4px;">Requires <a href="http://www.amazon.com/gp/kindle/mac/ref=kcp_mac_lnd_spl"&gt;Kindle for Mac Application</a></div></td></tr>

I want to open 'App A' when I click a button 'X'. I want to control (open doc/app ...) my Mac from Safari browser.

+1  A: 

The specifics I can not answer.

But the way it is done is that a mime type is registered on the Mac (via the Application, when it starts up or is installed). Then when the browser tries and opens the file, the web server says "this is a file of 'app/amazon_kindle'" (or whatever), and the Mac mates the two together to launch the application.

In other systems you would have to map an extension to a mime type. The Mac can do this, but it's optional.

That's the basics of how this works.

Will Hartung
A: 

It's a special namespaced link that requires the application to be on your computer. It's a combination of the browser talking to your local software that's listening for the event. iTunes has something similar.

I don't know if you'd be able to replicate this as the calls are proprietary. You may be able to with some hacking.

In the end, you can think of it like when you click a PDF link and it opens your PDF viewing application. Just keep in mind, the application has to be on the computer.

Jason McCreary
+4  A: 

Some of the other answers have the right gist, but I think it is a protocol handler rather than a MIME type. Kindle for Mac will have registered a handler for the "kindle:" protocol, either with OS X or directly with the browser (Safari, I guess), in a similar way that there is a default protocol handler for the "mailto:" protocol going to the Mail app.

This question has an answer on how to modify your app to register a protocol handler.

http://stackoverflow.com/questions/595481/register-a-protocol-on-mac-osx

Nick