Netscape Navigator and Microsoft Internet Explorer support compatible Apple Event interfaces.
A standard is emerging
With the introduction of Microsoft Internet Explorer for the Macintosh we have a new situation in the Mac scripting world: one program emulating the Apple Event interface of another. In this case MSIE implements the Netscape 2.0 AE interface.
This is good news for script writers, because, at least in theory, all the scripts that have been written to work with Netscape will also work with Microsoft.
It also makes the scripting interface part of the competition between both browsers. This means that bugs will likely be fixed, and new features added.
If you hit a dead-end in your web browser scripting, make your needs known on the "Frontier-talk" list. It's more likely that Netscape and/or Microsoft will respond.
I asked Marc Andreessen, the founder of Netscape, how he felt about this. Here's what he said:
We think it's really great that Microsoft has chosen to emulate our Mac Navigator scripting interface, as it provides a clear path for developers to take. Anything that inspires developers to do great stuff is good for Netscape, and standards as always are key.
A new architecture
It made sense to merge the interface table for both browsers into a new suite called "webBrowser". The suite determines, thru the use of an agent script, which web browser is running. The scripts automatically communicate with correct browser.
If you want to try something in Netscape, quit Microsoft and launch Netscape. When you're finished re-launch Microsoft. Your scripts don't care or know which browser is getting the messages.
Our goal is to integrate browsing into the activity of producing content for the web. The scripts we provide in this package are useful. New ideas are welcome!
And as usual, customization is very important. You now have all the tools you need to write your own scripts that run inside the web browser enviornment.
Two places to look for commands
1. In Frontier, look in the Net menu.
2. In your web browser, look in the Scripts menu.
View in Browser (in Frontier's Web menu)
Launch a web browser. In Frontier, cmd-J to examples.readme and choose View in Browser from the Net menu. The text appears in the web browser. If you want to edit the template that controls the look of this page, choose Edit Template from the Net menu. To change the placement of the title, use the <title> tag. To change the placement of the rendered object, change the placement of the <meat> tag.
You can actually view any Frontier object using this command. It's pretty hot. Try stepping thru the examples table pressing cmd-singlequote, the single-keystroke for the View in Browser command. Outlines are displayed as HTML lists.
Add to Glossary, View Glossary (in web browser's Scripts menu)
The glossary is a very powerful feature for scripted web pages created with BBEdit. To make the glossary easier, we've added a command to the web browser's shared menu that allows you to add the current page to the glossary used to build BBEdit pages.
Bring your web browser to the front and choose Add To Glossary from the Scripts menu. A dialog confirms that you want to add the item, and allows you to give it a name. When this name appears inside "double quotes" in your HTML text, a hotlink is automatically generated.
Choose View Glossary from the web browser's Scripts menu to see a listing of all the terms in your glossary. They are enabled, so you can see if the links work. This feature is explained on the BBEdit page.
Important note: the glossary is also available for text and outlines that are edited in Frontier thru the View in Browser command, described above.
Copy URLto Clipboard (in web browser's Scripts menu)
Copies the URL that the browser is currently displaying onto the Macintosh system clipboard.
Edit Local File (in web browser's Scripts menu)
If the page being displayed is stored on your local file system, this command decodes the URL and sends a message to your default text editor to open the file. This command is useful if you want to make a quick change to a page you're working on in BBEdit or another HTML text editing tool.
The first time you choose this command it prompts you to choose a text editor, and then remembers it for future edits. If you want to choose a different editor, cmd-J to scratchpad.texteditorapp and delete it. Next time you run the command you'll be prompted again.
Reveal Local File (in web browser's Scripts menu)
Again, for files on your local system, this command brings the Finder to the front and opens the folder that contains the file, and highlights it. This is important because it allows you to see the context in which the web page is being rendered by the web browser.
The BBEdit submenu (in web browser's Scripts menu)
I added a BBEdit submenu to the Scripts menu in web browsers, but there's only one command in the menu. If you have ideas for other commands that could go here, please discuss it on "Frontier-talk".
The Web Pages submenu (in web browser's Scripts menu)
This menu is intended to accumulate links for people who are web content developers using the specific products we're supporting. Any vendor who puts up a page with information that supports Frontier script writers will get space in this menu. With any luck I'll have to withdraw this offer soon! ;->
Writing your own scripts
To edit the scripts menu in Frontier, cmd-J to either system.menubars.MOSS or system.menubars.MSIE. Starting with Frontier 4.0b9, any changes you make in one will automatically be reflected in the other.
You can add your own commands to this menu. If you want to edit Frontier's menu bar, cmd-J to system.misc.menubar. Add your own commands to the Custom menu, or edit the Net menu.
In Frontier, cmd-J to webbrowser. You'll see a table of scripts, these are the messages your scripts can send to web browser applications.
Differences between Microsoft and Netscape
Here's a list of differences between MS's AE interface and Netscapes:
- required.openDocument opens a new window in MS, not in Netscape, see webBrowser.openDocument.
There's a bug in menu sharing for Netscape 2.0. If you open a mail window, the Scripts erroneously menu moves to the beginning of the menu bar, to the left of the Apple menu. The bug is fixed in Netscape 3.0 public betas.
We left system.verbs.apps.Netscape in the shipping root file so old scripts won't break. The Microsoft glue scripts table is there, but only has the most basic glue scripts in it. The goal is to migrate people to the webBrowser suite interface, but to make the move with no interruptions in service.
We deleted the Netscape.get table. The verbs in this table didn't work, so it's pretty likely that this won't break any scripts. The functionality is implemented in webBrowser.getFrontWindowTitle and webBrowser.getSource.
We deleted webBrowser.listwindows. It came from the msExplorer 'aete' resource. It's an exact duplicate of webBrowser.getWindowList.
Neither browser implements the following verbs: reload, goBack, goForward and fetchURL. How did these glue scripts get created? Hmmm. We deleted them.
© Copyright 1996-98 UserLand Software. This page was last built on 5/9/98; 8:29:12 AM.
It was originally posted on 5/2/96; 6:29:07 AM.