Set browser "helper" app

Richard Gaskin ambassador at fourthworld.com
Sat Feb 14 13:02:08 EST 2004


Richard Gaskin wrote:

> Devin Asay wrote:
> 
>> Does anyone know how to set the most commonly-used browsers in OS X to
>> automatically launch a rev stack (with Rev or some compiled Rev
>> launcher app) when it is clicked on in a web page? I want to be able to
>> have a user click on a stack link in my web page and have it launch,
>> instead of merely download or even try to show the contents in the web
>> page. Like happens when you click on a pdf link.
> 
> You can do this by adding the appropriate MIME type in the prefs for any
> browser -- except Apple's Safari. :(
> 
> I use Mozilla and I just launched stack files from my Web site.  :(
> 
> Th MIME types are there somewhere, only it seems Apple didn't provide an
> interface for editing them. There must be a way to hack this very basic
> functionality -- anyone know how?  :\

Follow up to this -

There are two ways to solve this challenge of browser/helper interaction:
adding a MIME type for .rev, and adding a custom helper app protocol.


Launching Stack Files
---------------------
Adding a MIME type seems to involve:

- On the server, adding the type to your server's .htaccess file.
- On the client:
    Win: Adding a couple registry entries (can be done with Rev)
    Mac: Adding a MIME type in your app's plist

I haven't yet had time to follow through on testing these, but I can't think
of any other required steps -- anyone know if I've missed one? I've
submitted a request to add "application/x-revolution rev" to my server's
.htaccess, so I can test once I finish up some client work.


Custom Protocol
---------------
More interesting is a custom protocol, so you can put links like this in
your pages:

  runrev://MyHandlerName

...and (on Mac) your app will get a GURLGURL Apple event with the full text
of the link as the data.  You could put any data you want in there, from a
file path to a Transcript command.  Accordingly, you'll want to avoid using
something as open as "do" for that since it would be a powerful security
exposure.  But with modest care it could be quite safe.

I'm not sure how the inter-app communication happens on Win; presumably with
DDE, requiring an external.  I don't yet know the details on the IAC for
Linux, but I presume it uses a socket, no?

The trick is finding a way to automate the adding of a new protocol helper.
It seems the API for Mac, Win, and Linux requires lower-level calls than can
be done from script (for Mac see the Internet Config API reference).  If
anyone finds a way to script those or writes an external I'd love to play
with it more when things slow down here.

In the meantime you can play around with this by setting it manually, at
least on a Mac:

Internet Explorer/Classic:
<http://campusgw.library.cornell.edu/newhelp/technical/set_up/browsers/msie3
M.html>

Any browser in OS X: <http://www.monkeyfood.com/software/MoreInternet/>


The Third Way
-------------
There's a third option that is easiest of all:  since your helper app is
already installed and the stack files will be run within it, why not just
launch them from there without requiring a browser at all, as RevNet does?

I'll admit there's a certain satisfying coolness in saying "My app has its
own protocol", but in terms of real-world needs only a relatively small
subset of workflows truly requires having the browser play a role.  In most
applications I can think of, since your app will be the central thing the
user is interacting with the desire to include the browser into the mix may
be more complicating than helpful.

If the goal is to launch stacks, there's little in the browser experience
that can't be done be done even more gracefully right in your own software.
Best of all, it's the simplest and most robust option as well, and will work
great on all supported platforms right out of the box, no fuss no muss.

-- 
 Richard Gaskin 
 Fourth World Media Corporation
 ___________________________________________________________
 Ambassador at FourthWorld.com       http://www.FourthWorld.com



More information about the use-livecode mailing list