Web Hosting Talk







View Full Version : directory protected question


Nam
01-09-2001, 10:12 PM
Ok, here is a very simple question. I've created the file that link to java.js in another dir. The dir has java.js, I protected it so nobody can see my file.

But when I run the index.htm file, which link to java.js, it asked me the password in other for script to work. My question is: Can I protect that file to prevent downloading but work as javascript in the mainpage without asking the password?

sodapopinski
01-09-2001, 11:49 PM
Nam,

As long as I know, it's impossible to do it.

Correct me if I'm wrong.

Thx.
Admin

Chicken
01-10-2001, 12:40 AM
Possibly absolute path with file below/another the viewable directory?

kunal
01-10-2001, 01:39 AM
Hmm.. I dun think this is possible. Simply, becuase, you are protecting the file from being viewed. So how can you make it viewable withougt getting rid of the protection?

Lawrence
01-10-2001, 01:47 AM
I'm pretty sure that can't be done as well. You could stop the browser from getting the file, but it would be up to the browser to stop the viewer actually seeing the file, and I don't think you could direct it to do that.

kunal
01-10-2001, 01:50 AM
On second thoughts try, protecting the "file" and not the directory it is in. What I mean to say is, if you chmod the file, to be readable to only the owner, then it might work. I think the chmod for only owner readable is, 700.

Lawrence
01-10-2001, 01:57 AM
600 actually kunal, but 700 should work (700 allows the owner to execute too).

Try it out, but I don't think it will work. JavaScript is client-side, and I'm pretty sure that the browser will call the external file in a similar way to an image. So it won't get "pasted" into the page as happens using SSI.

Unless it's server-side JavaScript? I'm not sure how that works exactly though.

But I don't have an alternate solution myself...

kunal
01-10-2001, 02:00 AM
600..700.. Whats the big deal? :D

sodapopinski
01-10-2001, 03:18 AM
Hi,

Originally posted by kunal
..file, to be readable to only the owner, then it might work. I think the chmod for only owner readable is, 700. [/B]

No no..It's impossible since .js is a client side scripting code.
Your visitor's browser must download this file first, otherwise they will not see how .js work.

Thx.
Soda

Nam
01-10-2001, 05:04 AM
The .js file contains pricing, which I don't want others to know, however, protected it and link as external file, like you all said, is impossible, too bad...

I haven't tried cmond 600 the file yet, but will that prevent downloading the file? like if they typ mydomain.com/file.js int their browser?

Anyway, thanks all.

etLux
01-10-2001, 05:07 AM
I'm just sticking a post in here so I get the e-mail notifications. I've never been able to get this to work, either... Usually, I wind up Perl-scripting it.

DaveC#
01-10-2001, 06:50 AM
Scramble your js file :)

http://www.geocities.com/SiliconValley/4274/jammer.htm

or

http://www.geocities.com/SiliconValley/Vista/5233/jmyth.htm


Microsoft script encoder will work for later versions of IE

http://msdn.microsoft.com/scripting/encoder/x86/se10en.exe Alpha http://msdn.microsoft.com/scripting/encoder/x86/se10en.exe

Félix C.Courtemanche
01-10-2001, 08:59 AM
you can also nest it to be hard to find & reach... if you want true safety, use SSI, PHP, ASP or any other server side programming to include it.

ASP could do it server-side easily I beleive, but I am far from sure.