mhadi wrote:
I am developing a solutions for clients to run some webpages. Since
there is no webserver the ASP route is a No Go. So I am using
Javascript to connect to my database.
JavaScript can be used in several contexts, we need to know which
context you use. Do you use it as script embedded in HTML documents that
you load locally from the file system in a browser? Do you use it as a
Windows Script Host script to be executed on Windows? Do you use it in a
HTML application, a HTA? Windows Script Host and/or HTA is usually a way
to have script with full rights and with file system access, with data
base access.
For instance in a Windows Script Host file you can get the current
directory your script is being executed in
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/a36f684c-efef-4069-9102-21b3d1d55e9e.asp>
That also works in a HTA e.g.
<html>
<head>
<title>Current directory</title>
<script type="text/jscript">
window.onload = function () {
try {
var wshShell = new ActiveXObject('WScript.Shell');
document.body.appendChild(
document.createTextNode('Current directory is: ' +
wshShell.CurrentDirectory + '. ')
);
}
catch (e) {
document.body.appendChild(
document.createTextNode('No access to WScript.Shell: ' + e.message)
)
}
}
</script>
</head>
<body>
</body>
</html>
With a normal HTML document loaded in IE you will run into security
problems, in particular on Windows XP Service Pack 2 and later with
local file system lockdown done there by default.
Windows Script Host docs are online here on MSDN:
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/d78573b7-fc96-410b-8fd0-3e84bd7d470f.asp>
HTA docs here:
<http://msdn.microsoft.com/library/default.asp?url=/workshop/author/hta/hta_node_entry.asp>
--
Martin Honnen
http://JavaScript.FAQTs.com/