to be accessible to the extension to link to because you can't link to
anything outside the chrome folder or I'll have to use file:// which
might produce problems on multiple OS
Nickolay Ponomarev wrote:
On 2/13/07, Masry Alex <[EMAIL PROTECTED]> wrote:
did you read the code on my previous posts? is there something wrong with
the mailing list?
I haven't seen it. Why do you need to link to images as chrome:// ?
Nickolay
here is the code again
function get_image(img){
var defaulturl = 'http://site.com/'+img;
var newurl = 'chrome://ext/skin/cache'+img;
try{
const id = "{extID}";
var file =
Components.classes["@mozilla.org/extensions/manager;1"]
.getService(Components.interfaces.nsIExtensionManager)
.getInstallLocation(id)
.getItemLocation(id);
file.append("chrome");
file.append("skin");
file.append("cache");
file.append(img);
if (file.exists()) return newurl;
var obj_URI =
Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService).newURI(defaulturl,
null, null);
var obj_Persist =
Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].createInstance(Components.interfaces.nsIWebBrowserPersist);
var cachekey =
Components.classes['@mozilla.org/supports-string;1'].createInstance(Components.interfaces.nsISupportsString);
cachekey.data = defaulturl;
obj_Persist.persistFlags =
Components.interfaces.nsIWebBrowserPersist.PERSIST_FLAGS_FROM_CACHE
|
Components.interfaces.nsIWebBrowserPersist.PERSIST_FLAGS_CLEANUP_ON_FAILURE;
obj_Persist.saveURI(obj_URI,cachekey,null,null,null,file);
return defaulturl;
}catch(e){
dump(e);
return defaulturl;
}
}
I just need a confirm that it works fine on other OS other than windows
[EMAIL PROTECTED] wrote:
I'm trying to link to images using chrome:// which I have to retrieve the
ext dir not the profile dir to save images
http://developer.mozilla.org/en/docs/Code_snippets:File_I/O#Getting_your_extension.27s_folder
>save the images in the "local settings" dir - ProfLD key to the directory
service, iirc.
What is ProfLD? I'm only familiar with ProfD.
________________________________
_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners
_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners
_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners
_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners