How To Send URLs From iPhone to Home Browser

I’ve run in to many times where I’m browsing on my iPhone or iPad and want to browse a page at home, but there is no easy was to send the URL and have it just open in my desktop machine’s browser. Well today I figure it out and here’s how you do it.

You will need:

  • An AIM client on your iPhone/iPad – I’m currently using Beejive AIM, but that may change.
  • A “remote” AIM account and a home AIM account.
  • A Mac with iChat running – set it to auto launch at login.
  • My cool AppleScript to glue it all together.

The AppleScript

1. Copy this script and save it in your iChat Script folder. Generally that’s in your home folder /Library/Scripts/iChat/.

using terms from application “iChat”
on message received theMessage for theChat
if theMessage contains “http” then
tell application “Google Chrome”
set URL of active tab of window 1 to theMessage
activate
end tell
end if
end message received
end using terms from

Couple of notes about the script.
We’re going to link this script to a specific buddy. If you linked it to everyone, then any URL in any chat would open in your browser. You don’t want that.
Because we don’t check the buddy in the script you can connect it to two or more buddies and any of them could open URLs.

Set Up AIM programs

You want to add both accounts to the buddy list of your phone AIM program and your desktop’s iChat.
Add your “remote” AIM account to your home AIM’s buddy list.
Add your home AIM to your phone’s buddy list.

In iChat select your remote account’s buddy and select Buddies->Show Info. A window will open, select the Alerts tab. Check the “Run an AppleScript script:” check box. From the popup select the script you just saved to your iChat folder.

If you save your script somewhere else and select it from this pop up using “Choose Script…”, iChat will copy it to the iChat folder, not use it where it is. So if you edit it where you saved it, iChat won’t see that change.

That’s it. Now send an text message with a URL in it.

Couple of caveats.
If you use Beejive AIM on the iPhone it has a UI weirdness where you have to start typing a message before you can paste. So type a space and then do your paste.
If you send something else besides the URL in the text message your browser will give AppleScript an error. A beginning space doesn’t count, so it’s OK.