You are right, using the AllowFileAccessOutsideOfWidget key worked, though
only halfway. It opened the application in Preview instead of Safari. I
would think that with the "file://" prefix it should be obvious it's meant
for a web browser. It must just call widget.system("/usr/bin/open...").
Preview isn't quite the same thing because you can't drag the image around
unless you open the drawer of images first (not so obvious to a lot of users
I think). Probably one of the sticking points is that calling
widget.openURL(url) is defined to open in the default browser (not
necessarily Safari). Since I have to hard-code it to open in Safari, it
will open in the non-standard browser on some user's systems.
I found a workaround for opening local file URLs. The command looks like
this:
widget.system("/usr/bin/open -a /Applications/Safari.app
/Users/username/image.jpg", null);
If you keep the "file://" prefix on the filename it opens in the Preview
application instead.
Other interesting observations:
(1) creating an image object with myImage = new Image();
myImage.src="files/image.jpg";
results in the same value for "myImage.src" if you retrieve it after
the image has been loaded
However,...
If you load the same image through the document with
myImage = document.getElementById("imgTag4"); myImage.src =
"files/image.jpg";
then when you retrieve the value "myImage.src" after the image is
loaded, it has been
appended with the prefix "file://..." including the full pathname to
the file.
(2) calling widget.system("/bin/ls") without the second (endHandler)
parameter will crash
the entire widget (3 times in a row until the widget launcher gives
up)
Brian
----Original Message Follows----
From: "Brian Klock" <email@hidden>
To: email@hidden
Subject: widget.openURL("file://....")
Date: Mon, 21 Nov 2005 19:39:52 -0800
Has anyone found a way to get widget.openURL(url) to succeed if it is passed
a url that begins with "file://"? It must be either a security constraint
or a mistake in the widget API, though I'm not sure the logic could be for
giving widgets a constraint such as this.
Brian
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden