views:

270

answers:

1

Hi sir/madam!

I am putting up a small website via webs.com for me and my friends that could also be accessible via wap, i.e. mobile internet, and I want to add links to my site that downloads .jar files. I uploaded the files on my site, and links to the .jar files went fine, but I also need links for .jad files (for some mobile phones that require .jad files FIRST then .jar). I tried doing a regular link for the .jad files, but it simply displayed the content of the .jad file. It wasn't installed or downloaded. What should I do? Or am I at a wrong website? Thanks!

A: 

JAD files are textbased. Their default content type is text/vnd.sun.j2me.app-descriptor. Every webbrowser will by default display responses with a content type matching text/* inline.

The best solution is to configure/change the response header to include a Content-Disposition with a value of attachment. This way the webbrowser will be forced to pop a Save As dialogue. It's unclear what server side programming language you're using in the website, but if it is for example PHP, then you can do so:

header('Content-Disposition: attachment;filename="' . $jad_file_name . '"');

Or if it is Java/Servlet:

response.setHeader("Content-Disposition", "attachment;filename=\"" + jadFileName + "\"");

Or if you are using none, them you may try it with an .htaccess in the same directory of the JAD files:

<Files *.jad>
    Header set Content-Disposition attachment
</Files>
BalusC
Ahm..I had quite a lot of researching about everything posted here. But I don't seem to exactly get it. (I'm a noob in programming *heh*)Is that header you're telling me is the source code of the .jar file itself? Or the .jad? Or none of them?And where will I configure these? At the site itself or at the files to be downloaded?I'm using webs.com as my site, and me too I don't know if i'm using PHP, java/servlet, or none. And it looks like I dont have access to the HTML codes of my site. I'm using the SiteBuilder thing (using the drag n drop method/s)Help me broaden my knowledge. Thanks!
Jareim
OK, then go for the `.htaccess` approach (if webs.com supports it). If one already exist in the same folder as the JAD file is been served from, then modify it by adding the mentioned lines to it. Or if none exist, then create a new `.htaccess` file with just the aforementioned content.
BalusC