Trying to hide the address bar on Safari using Applescript or Javascript

Hello,

I am writing a web-based app that needs to launch a browser window from an applescript file. (the pc side uses a .vbs file to do the same thing.)

I can do it with applescript and "System Events" :

tell application "Safari"
activate
make new document with properties {URL:"http://IPADDRESS/default.aspx"}
do JavaScript ("self.resizeTo(500,480);") in document 1

tell application "System Events"
keystroke "B" using {command down, shift down}
keystroke "/" using command down
keystroke "|" using command down
end tell
end tell

But this affects the entire Safari application so new windows opened by the user appear the same way. I need it to only affect the window that is opened. I tried some JS "toolbar=no" type commands but it did not have any effect. I must admit my JS and AS is very basic at this point so it could have been poor syntax..

Can any of you fine folks suggest a way to do this?

Macs, macs and more macs...oh yeah. Linux too., Mac OS X (10.5.7), Safari 3 and 4 Beta.

Posted on Jun 5, 2009 1:29 PM

Reply
4 replies

Jun 5, 2009 1:36 PM in response to gryphontech

Would it be of any better overall results to see if the Toolkit
used by developers to make variations of Safari browser, to
make a line of code or other changes to your browser; or to
get a third-party browser already changed by design, and
use that instead of writing scripts for Safari?

There are a few good Apple-based third party browsers
which may yield to other developer-level techniques.
Though I do not change the nature of my applications,
I sometimes look into similar others to see if they may
do something the other ones don't; or do it better.

Thought I'd ask...
Good luck & happy computing! 🙂

Jun 5, 2009 4:22 PM in response to gryphontech

There may be some information of use to your quest
in places such as this Safari Developer FAQ page:
http://developer.apple.com/internet/safari/faq.html

There also is some kind of build kit such as those
used to develop and produce Camino or other
Apple webkit based browsers available now...
There is a debug menu option in Safari, too.

In any case...
Good luck & happy computing! 🙂

Jul 11, 2009 12:41 AM in response to gryphontech

I have a question that might be related to this and it might sound dumb and simple but I am doing it for a reason. I am ultimately trying to create an applescript that adds the home button into the safari toolbar. I've been researching for days and just cant figure it out. I think it has something to do with javascript but im not sure. I thought you guys might be able to help me out. Thanks!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Trying to hide the address bar on Safari using Applescript or Javascript

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.