1

Amazon has the button that opens an app as follows.

http://img836.imageshack.us/img836/6829/screenshot20100724at111.png

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">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.

IAdapter
  • 62,595
  • 73
  • 179
  • 242
prosseek
  • 182,215
  • 215
  • 566
  • 871
  • Have you viewed the source of the page? – ChrisF Jul 24 '10 at 16:29
  • it says 'Requires Kindle for Mac Application', so it's opening the application from your computer. – SoftwareGeek Jul 24 '10 at 16:29
  • @SoftwareGeek : I want to know how to control ''my'' app from web browser. – prosseek Jul 24 '10 at 16:33
  • Ah, so what is the security error message? can you post an image of that? I think it's got to do with some configuration on your end. – SoftwareGeek Jul 24 '10 at 16:47
  • @SoftwareGeek : The Safari doesn't show anything, it just doesn't do anything. For Mac Tiger, I could open an app with Safari, not anymore. – prosseek Jul 24 '10 at 20:53
  • macOS also supports universal links. See [this answer](https://stackoverflow.com/a/60395035/7365866) though it seems like watered down (e.g. needing Safari to be default browser, and app not opening when link is clicked from inside Safari). Someone suggested using URL schemes instead. – Ben Butterworth Dec 28 '22 at 20:02

3 Answers3

4

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.

register a protocol on mac osx?

Community
  • 1
  • 1
Nick
  • 11,475
  • 1
  • 36
  • 47
1

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
  • 115,893
  • 19
  • 128
  • 203
0

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
  • 71,546
  • 23
  • 135
  • 174