Christian Biesinger wrote:

> var file = Components.classes["@mozilla.org/file/directory_service;1"]
>                       .getService(Components.interfaces.nsIProperties)
>                       .get("CurWorkD", Components.interfaces.nsIFile);

Works great, I can go further with that.

> > Or to the local html file you're currently displaying?
>
> Yes, but to answer how I'd need to know what you have...

I don't use XUL, I load a HTML page as a chrome (or so I've been told
here:)
pref("toolkit.defaultChromeURI",
"chrome://testapp/content/start.html");

> If you have an nsIWebNavigation, you can get an nsIURI from that.

I've tried the following code:

var navigation =
//Components.classes["@mozilla.org/webshell;1"]
Components.classes["@mozilla.org/embedding/browser/nsWebBrowser;1"]
.getService(Components.interfaces.nsIWebNavigation);
alert(navigation.currentURI);

I got "NS_ERROR_UNEXPECTED" from nsWebBrowser and "undefined" from
webshell.

But, like I said, your first example was a great help. Thanks!

Jan

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to