What's the comparable file in .js to Global.asa in ASP?

G

Greener

Hi, I need help badly. Sorry for my ignorance! What's the comparable
file in .js to Global.asa in ASP to capture the browser version (IE
vs. Netscape)? Any existing code to share or if you have a better way
to do it without using any server-side programming?

Can you write:
if (navigator.userAgent.indexOf("MSIE") != -1) as Client-side
programming within a HTML file instead of in a .js or .asp file? I
tried to write this piece of code in a HTML file, but it doesn't work.
So I am wondering about what's wrong. Thanks for your advice.

Helena
 
H

Hywel Jenkins

helena1995 said:
Hi, I need help badly. Sorry for my ignorance! What's the comparable
file in .js to Global.asa in ASP to capture the browser version (IE
vs. Netscape)?

There isn't any. Global.asa isn't necessarily there to capture browser
info, though, is it?
Can you write:
if (navigator.userAgent.indexOf("MSIE") != -1) as Client-side
programming within a HTML file instead of in a .js or .asp file?

Yes.
<script type="text/javascript">
if (navigator.userAgent.indexOf("MSIE") != -1)
</script>
 
K

kaeli

And on the day 7 Oct 2003 15:16:01 -0700, (e-mail address removed)
enlightened us with said:
Hi, I need help badly. Sorry for my ignorance! What's the comparable
file in .js to Global.asa in ASP to capture the browser version (IE
vs. Netscape)? Any existing code to share or if you have a better way
to do it without using any server-side programming?

Why would you want to?
It's much easier to capture objects instead and works in more than one
browser.
Also, testing for objects prevents problems like people who use IE4 or
if the IE for Mac didn't support something.
Can you write:
if (navigator.userAgent.indexOf("MSIE") != -1) as Client-side

Why?
IE5(.5?)+ has document.all as well as document.getElementById. As does
Opera (if you set it to). To make a script that works in all browsers
that support those constructs (there may be more), you'd do

if (document.all && document.getElementById)

Heck, if you don't have to support all browsers, you can just test for
document.getElementById and pop an alert for all the others. That would
make it work in IE5.5+, NN6+, Mozilla, Opera (6?)+...

--------------------------------------------------
~kaeli~
Kill one man and you are a murderer. Kill millions
and you are a conqueror. Kill everyone and you
are God.
http://www.ipwebdesign.net/wildAtHeart/
http://www.ipwebdesign.net/kaelisSpace/
------------------------------------------------
 
G

Greener

Thanks a lot. What I was trying to do is the following: opening a file
in different ways when dealing with different browsers. So would your
code work for this function? Bear with me, a greener, for the
ignorance.
 
K

kaeli

And on the day 8 Oct 2003 12:04:30 -0700, (e-mail address removed)
enlightened us with said:
Thanks a lot. What I was trying to do is the following: opening a file
in different ways when dealing with different browsers. So would your
code work for this function? Bear with me, a greener, for the
ignorance.

Most browsers won't allow you to use javascript to open a file. IE will
under some circumstances (lowered security, ActiveX, etc).
Normal security settings don't allow for the opening of a file with
javascript because it runs on the client and that would be a bad thing
for malicious people to be able to do. When using server-side script to
open a file on the server, the browser is irrelevant.

What file do you need to open? Is this for a CD, intranet application,
active desktop, or...? If you're making something for a CD, you could
use an HTA - it gets better permissions. I think Windows as the OS is
required to use an HTA.

--------------------------------------------------
~kaeli~
Kill one man and you are a murderer. Kill millions
and you are a conqueror. Kill everyone and you
are God.
http://www.ipwebdesign.net/wildAtHeart/
http://www.ipwebdesign.net/kaelisSpace/
------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top