469,271 Members | 1,787 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Signed javascript?

Hi,

I just wonder if anybody can help me with this:
I need to give my javascript code some extended permissions for disk access on client's machine,
and as i understand i need to sign this js. Can someone tell me how to sign js to work with with ie?
Can i put my js file into jar and use jarsigner for that?
And by the way, would it give me disk access permissions?

I need that for the following: our client gets a cd from us with some mp3 files. When they log onto
our web site, they see some links:
eg <a href="file:///e:/resource/file.mp3"><a/>

pointing to the files in their cd, so when they click on a link, that file should start playing.

Or is there another way to access client's disk from a web page for a task like described?

I would highly appreciate any ideas/suggestions!

Thank you in advance!
Andrey
Jul 23 '05 #1
12 8255
On Wed, 06 Oct 2004 14:48:06 GMT, Andrey wrote:
Can i put my js file into jar and use jarsigner for that?


You can put Java classes into a jar and use Sun's jar signing
tool to give it extended privileges, but that will not work
with *Javascript*.
<http://www.physci.org/codes/javafaq.jsp#js>

Figure out exactly what you are dealing with before you proceed.

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
Jul 23 '05 #2
Andrew Thompson wrote:

<snip>
You can put Java classes into a jar and use Sun's jar signing
tool to give it extended privileges, but that will not work
with *Javascript*.
<http://www.physci.org/codes/javafaq.jsp#js>

Figure out exactly what you are dealing with before you proceed.


That post seemed perfectly on-topic to me. The OP was obviously asking
whether JavaScript can be put into a jar file and signed, just like Java
can.

At least, I imagine that by "js file" it was meant "file with a .js
extension"....

Stewart.
Jul 23 '05 #3
Andrew Thompson wrote:
On Wed, 06 Oct 2004 14:48:06 GMT, Andrey wrote:

Can i put my js file into jar and use jarsigner for that?

You can put Java classes into a jar and use Sun's jar signing
tool to give it extended privileges, but that will not work
with *Javascript*.
<http://www.physci.org/codes/javafaq.jsp#js>

Figure out exactly what you are dealing with before you proceed.

Andrew, my question is about JavaScript, not Java.
Maybe it confused you when i asked about signing jar file, but i've seen something on the internet
about calling javascript from a signed jar - yes, just client-side javascript code, not a Java
applet or anything else.

Ok, here's my problem - say i have a bunch of links on my web page and i need to show/hide them
depending on what files present on client's machine - so i want to do it using JavaScript/DHTML.

But to access client's resources(eg CD-ROM), i need to get special permissions, right?
So my question is if JavaScript code can be signed to get access to client's resources?

I've seen in a js book that UniversalBrowserRead (or something like that) permissions are required,
so my question is how do i do that?
Thank you in advance,
Andrey

Jul 23 '05 #4
Stewart Gordon wrote:
Andrew Thompson wrote:

<snip>
You can put Java classes into a jar and use Sun's jar signing tool to
give it extended privileges, but that will not work with *Javascript*.
<http://www.physci.org/codes/javafaq.jsp#js>

Figure out exactly what you are dealing with before you proceed.

That post seemed perfectly on-topic to me. The OP was obviously asking
whether JavaScript can be put into a jar file and signed, just like Java
can.


You are right :) But more generally i've asked if there is a way to enable javascript access to a
local resource (hard-drive or cd-rom)

Do you know anything about this?

At least, I imagine that by "js file" it was meant "file with a .js
extension"....

That's perfectly true :)

Thank you
Andrey
Jul 23 '05 #5
"Andrey" <le*******@yahoo.com> wrote in message
news:WpU8d.341509$Fg5.329447@attbi_s53...
Andrew Thompson wrote:
On Wed, 06 Oct 2004 14:48:06 GMT, Andrey wrote:

Can i put my js file into jar and use jarsigner for that?

You can put Java classes into a jar and use Sun's jar signing
tool to give it extended privileges, but that will not work
with *Javascript*.
<http://www.physci.org/codes/javafaq.jsp#js>

Figure out exactly what you are dealing with before you proceed.

Andrew, my question is about JavaScript, not Java.
Maybe it confused you when i asked about signing jar file, but i've seen

something on the internet about calling javascript from a signed jar - yes, just client-side javascript code, not a Java applet or anything else.

Ok, here's my problem - say i have a bunch of links on my web page and i need to show/hide them depending on what files present on client's machine - so i want to do it using JavaScript/DHTML.
But to access client's resources(eg CD-ROM), i need to get special permissions, right? So my question is if JavaScript code can be signed to get access to client's resources?
I've seen in a js book that UniversalBrowserRead (or something like that) permissions are required, so my question is how do i do that?
Thank you in advance,
Andrey


Perhaps a modification of the following?

<html>
<head>
<title>if_file.htm</title>
</head>
<body>
<script type="text/javascript">
var wNT = "C:\\WinNT\\system.ini";
var w98 = "C:\\Windows\\system.ini";
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
if (oFSO.FileExists(wNT)) alert(wNT);
if (oFSO.FileExists(w98)) alert(w98);
</script>
</body>
</html>
Jul 23 '05 #6
McKirahan wrote:

<...>

Perhaps a modification of the following?

<html>
<head>
<title>if_file.htm</title>
</head>
<body>
<script type="text/javascript">
var wNT = "C:\\WinNT\\system.ini";
var w98 = "C:\\Windows\\system.ini";
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
if (oFSO.FileExists(wNT)) alert(wNT);
if (oFSO.FileExists(w98)) alert(w98);
</script>
</body>
</html>


Right, that's exactly what i want to do, but the problem that IE will not allow to run this script
on client machine because of security issues.
So i need to make this javascript 'trusted', and that's my question - how?

Thank you,
Andrey
Jul 23 '05 #7
VK
Signed JavaScript technology (.js in .jar) has been implemented in 4th
Netscapes and died with them. Starting 5th version (AKA 6th) they dropped
it. IE never supported it. Also even then you would not get the disc access,
it was all for "little" privileges: chromeless windows, off-screen
positioning etc.

You may start with a simple BlahBlah.hta page
If user grants permission on request, you can create an FileObject and go
on.

Also put a complain form on the same page ("My X browser doesn't work, what
a hell?")
If you collect at least 40-50 nasty ones, you may consider to buy a code
signing cert and mess up with signed applets/ActiveX. Up to that point HTA
would be sufficient.
:-)
:-|
Jul 23 '05 #8
"Andrey" <le*******@yahoo.com> wrote in message
news:M9V8d.190998$MQ5.20101@attbi_s52...
Right, that's exactly what i want to do, but the problem that IE will not allow to run this script on client machine because of security issues.
So i need to make this javascript 'trusted', and that's my question - how?

Thank you,
Andrey


As VK suggested, try an HTA (HTML Application):

<html>
<head>
<title>if_file.hta</title>
</head>
<body>
<script type="text/javascript">
var wNT = "C:\\WinNT\\system.ini";
var w98 = "C:\\Windows\\system.ini";
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
if (oFSO.FileExists(wNT)) alert(wNT);
if (oFSO.FileExists(w98)) alert(w98);
</script>
</body>
</html>
Jul 23 '05 #9
McKirahan wrote:
"Andrey" <le*******@yahoo.com> wrote in message
news:M9V8d.190998$MQ5.20101@attbi_s52...
Right, that's exactly what i want to do, but the problem that IE will not


allow to run this script
on client machine because of security issues.
So i need to make this javascript 'trusted', and that's my question - how?

Thank you,
Andrey

As VK suggested, try an HTA (HTML Application):

<html>
<head>
<title>if_file.hta</title>
</head>
<body>
<script type="text/javascript">
var wNT = "C:\\WinNT\\system.ini";
var w98 = "C:\\Windows\\system.ini";
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
if (oFSO.FileExists(wNT)) alert(wNT);
if (oFSO.FileExists(w98)) alert(w98);
</script>
</body>
</html>


Ok, it's closer. But if i launch this hta file, it pops a new blank window after the alert is ok'd.
But i need to integrate this into my existing web site, with no additional windows to popup.
Jul 23 '05 #10
VK wrote:
Signed JavaScript technology (.js in .jar) has been implemented in 4th
Netscapes and died with them. Starting 5th version (AKA 6th) they dropped
it. IE never supported it. Also even then you would not get the disc access,
it was all for "little" privileges: chromeless windows, off-screen
positioning etc.

You may start with a simple BlahBlah.hta page
If user grants permission on request, you can create an FileObject and go
on.

Also put a complain form on the same page ("My X browser doesn't work, what
a hell?")
If you collect at least 40-50 nasty ones, you may consider to buy a code
signing cert and mess up with signed applets/ActiveX. Up to that point HTA
would be sufficient.
:-)
:-|

Well, hta don't work for me - when i load a hta page, it gives an option to Open/Download, which is
not clear for a user in the first place - our users are ... just users, if you know what i mean :)))
Also it pops a new blank window after i choose Open.
But the problem is that i may not change the structure we have, i may only add some functionality to
the existing aspx/html pages.
And i'm ok if i need to buy a certificate (from VeriSign?) - anyway my boss will be buying it, so i
don't care :)
But i need to get to the right direction with that - say, how can ActiveX help me?
I tried using the code McKirahan provided, but on html page not a hta, and got an error that
automation server can't create an object () - is it a permissions issue?
Error appeared while executing
var oFSO = new ActiveXObject("Scripting.FileSystemObject");

Speaking about java applets - i use "tinyplayer" - free java applet for playing mp3's.
If i sign this applet and place in on the web page on the web server, it allows me to play files
from my local server (i put link like "http://localhost:81/file.mp3"), but if i give it a file:///
location it doesn't play - i guess also permissions...

So what about ActiveX? Where should it be placed?

Please please please any ideas!

Thank you in advance
Andrey
Jul 23 '05 #11
You can run Javascript code that accesses local resources like
ActiveXObject, etc., from within a web-page. You must put the code (js
files) in a signed CAB file.

I did this many years ago with Internet Explorer 4.x and 5.x. They
have have removed that priviledge in IE 6.0, but I'm not certain about
that.

-Kody
Jul 23 '05 #12
On 8 Oct 2004 14:18:29 -0700, Kody Brown wrote:
You can run Javascript code that accesses local resources like
ActiveXObject, etc., from within a web-page. You must put the code (js
files) in a signed CAB file.
I can finally make sense of the OP's statement.

CAB files are for the MSVM exclusively.
I did this many years ago with Internet Explorer 4.x and 5.x. They
have have removed that priviledge in IE 6.0, but I'm not certain about
that.


...given they have removed the MSVM[1], it is not a
question of removing the 'privilege'..

[1] The MSVM is also actively being removed from remaining IE
(4/5 & 6) implementations that have it. I distribute a Java
tool that removes it[2], though there are a variety of ways
to remove or disable the MSVM.

[2] <http://www.physci.org/jvmclean.jsp>

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
Jul 23 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by LC's No-Spam Newsreading account | last post: by
2 posts views Thread by FatBo | last post: by
11 posts views Thread by chanma | last post: by
10 posts views Thread by =?iso-8859-2?B?SmFuIFJpbmdvuQ==?= | last post: by
1 post views Thread by jindalily | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.