Using mozilla/firefox we can view a file inside a zip/jar/xpi
zip/jar/xpi may be at http://, file://, resource://
(i have not tried ftp:// but I belive that too)
Try
<a href="jar:http://mirror.meisterwerk.net/rmozdev/links/WebLinks.xpi!/install.js"> jar:http://mirror.meisterwerk.net/rmozdev/links/WebLinks.xpi!/install.js </a>
resource:// on Firefox:
jar:resource:///chrome/browser.jar!/content/browser/about.png
jar:resource:///chrome/browser.jar!/content/browser/browser.js
resource:// on Mozilla
jar:resource:///chrome/modern.jar!/skin/modern/communicator/button.css
we can even do
<a href="jar:jar:http://mirror.meisterwerk.net/rmozdev/links/WebLinks.xpi!/WebLinks.jar!/content/weblinks/macroeditor.js"> jar:jar:http://mirror.meisterwerk.net/rmozdev/links/WebLinks.xpi!/WebLinks.jar!/content/weblinks/macroeditor.js</a>
yeah, read from a zip file inside another zip file.
XMLHttpRequest can also handle this
Code: Select all
function readfileinjar(url,path)
{
var p = new XMLHttpRequest();
var path2 = path;
if(path2.substr(0,1) != "/") path2="/" + path2;
p.open("GET", "jar:" + url + "!" + path2, false);
p.send(null);
return p.responseText;
};
then call it by
Code: Select all
alert(readfileinjar("http://mirror.meisterwerk.net/rmozdev/links/WebLinks.xpi", "/install.js") )