469,322 Members | 1,564 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,322 developers. It's quick & easy.

Prevent file execution when opened in browser

Hi,

I have a requirement in which I have Prevent code from being executed when opened in browser. To put it in simple words, consider the following scenario
I have a locale.properties file present in webserver.
if i tries to open this file from browser, instead of displaying the content, it should popup a dialog-box asking user to open/save/cancel.

Any help in this regard will be appreciated. Let me know if my requirement is not clear.


Thanks
sunny
Oct 21 '08 #1
2 1150
acoder
16,027 Expert Mod 8TB
You can't do this with JavaScript. Keep the file out of the web root.
Oct 21 '08 #2
pronerd
392 Expert 256MB
I properties file is not executable. It is just plain text, it can only be displayed.

If you want to force a save file dialog box you will need to change the response MIME type to an invalid value. Something like "application/unknown" or "app/download". That is not something you do with JavaScript. You would need to change the server configuration, or use server side code.
Oct 21 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Frank | last post: by
1 post views Thread by hotice3100 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.