view a file inside a zip/jar/xpi

Talk about add-ons and extension development.
Posts: 399
Joined: March 18th, 2003, 9:52 pm

Post Posted February 21st, 2004, 9:55 am

This is new to me,

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)
<a href="jar:!/install.js"> jar:!/install.js </a>

resource:// on Firefox:

resource:// on Mozilla

we can even do
<a href="jar:jar:!/WebLinks.jar!/content/weblinks/macroeditor.js"> jar:jar:!/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;"GET", "jar:" + url + "!" + path2, false);   
 return p.responseText;

then call it by
Code: Select all
 alert(readfileinjar("", "/install.js") )
8) Biju
MacroEditor | | Edit files inside ZIP,JAR,XPI
Cure Cancer | GNOME,*nix on MSWin32

Thumper's Evil Twin

User avatar
Posts: 6422
Joined: December 9th, 2003, 3:52 pm
Location: Glasgow, Scotland

Post Posted February 21st, 2004, 10:15 am

haha! awesome. I'd never thought of this. :)

- Chris


User avatar
Posts: 700
Joined: June 28th, 2003, 8:31 am
Location: Longitude 0ish

Post Posted February 21st, 2004, 10:33 am

what about view-source:chrome://browser/content/browser.xul ?

Posts: 399
Joined: March 18th, 2003, 9:52 pm

Post Posted February 21st, 2004, 10:39 am

So this also works
Code: Select all

Now, how can we see the dir listing inside a zip?


Posts: 1634
Joined: November 4th, 2002, 8:34 pm
Location: Kyoto, Nippon (GMT +9)

Post Posted February 22nd, 2004, 9:01 am

Hmm, interesting. In such a complicated scheme, what's their script security level?

Return to Extension Development

Who is online

Users browsing this forum: No registered users and 2 guests