Hi, I need help badly. Can you do client-side programming instead of
server-side to capture the Browser type info? If this is the case,
what's wrong with the following?
<script language="JavaS cript">
function doWord(file)
{
if (navigator.user Agent.indexOf(" MSIE")!=-1)
{
var w = new ActiveXObject(" Word.Applicatio n");
if (w != null)
{
w.Visible = true;
w.Documents.Ope n(file);
}
}
else
{
document.write( ...)
}
}
</script>
but it doesn't work.
So I am wondering about what's wrong. Thanks for your advice.
Helena 10 3392
In article <9c************ *************@p osting.google.c om>, he********@yaho o.com (Greener) writes: Hi, I need help badly. Can you do client-side programming instead of server-side to capture the Browser type info?
You can do it, reliably, neither on the server nor in the browser. Why does it
matter what browser I am using?
If this is the case, what's wrong with the following?
The major problem is you are relying on an unreliable string to attempt to
determine the browser.
<script language="JavaS cript"> function doWord(file) {
if (navigator.user Agent.indexOf(" MSIE")!=-1)
Not sure how to object test for ActiveX, never tried to. And there is probably
a browser besides IE that will pass the following, but I am not sure:
if (document.all && document.getEle mentById &! window.opera){
alert('You might be using IE')
}
Perhaps a VBScript script instead, which is IE only (as far as I know):
<script type="text/vbscript">
//Not a single clue what would go here
</script>
None of which relies on what browser I am using. http://www.jibbering.com/faq/#FAQ4_26
And links therein, to http://www.xs4all.nl/~ppk/js/support.html
--
Randy
Greener said: Hi, I need help badly. Can you do client-side programming instead of server-side to capture the Browser type info? If this is the case, what's wrong with the following?
<script language="JavaS cript"> function doWord(file) {
if (navigator.user Agent.indexOf(" MSIE")!=-1) { var w = new ActiveXObject(" Word.Applicatio n"); if (w != null) { w.Visible = true;
w.Documents.Ope n(file);
} } else { document.write( ...) }
} </script>
but it doesn't work. So I am wondering about what's wrong. Thanks for your advice.
It should have some sort of error handling code in case w == null,
but other than that, it works for me. What do you mean when you
say "it doesn't work". What does it do, instead of opening Word?
"HikksNotAtHome " <hi************ @aol.com> wrote in message
news:20******** *************** ****@mb-m11.aol.com... In article <9c************ *************@p osting.google.c om>, he********@yaho o.com (Greener) writes:
Hi, I need help badly. Can you do client-side programming instead of server-side to capture the Browser type info? You can do it, reliably, neither on the server nor in the browser. Why does it matter what browser I am using?
I assume that was intended to start "you can not do it, . . . ". If this is the case, what's wrong with the following?
The major problem is you are relying on an unreliable string to attempt to determine the browser.
<script language="JavaS cript"> function doWord(file) {
if (navigator.user Agent.indexOf(" MSIE")!=-1)
Not sure how to object test for ActiveX, never tried to. And there is probably a browser besides IE that will pass the following, but I am not sure:
Yes, Konqueror (so probably Safari), IceBrowser and Web Browser 2.0. In
fact I think that test probably only rules out Opera and Gecko browsers
as it seems to be common these days for non-IE browsers to be
implementing a document.all collection.
if (document.all && document.getEle mentById &! window.opera){ alert('You might be using IE') }
<snip>
I would have thought that, since the desire is to call the ActiveXObject
constructor, the pertinent test would be for the existence of the
ActiveXObject constructor:-
if(window.Activ eXObject){
// new ActiveXObject can be called.
}
-or-
if(typeof ActiveXObject != 'undefined'){
// new ActiveXObject can be called.
}
Following the principal that you feature/object test as close to the
problem as possible.
However, with IceBrowser being an example of at least one browser that
has a fake ActiveXObject constructor it becomes very important to test
the object returned to ensure that it is an object. The OP's - if (w !=
null) - is a good start but it would also be worth checking that the
object has the methods and properties that the script wants to call (eg.
Documents.Open) in case the ActiveXObject constructor is a fake that
just returns a standard JavaScript object.
But then there are the ActiveX user preferences. My IE 6 will not allow
any scripting of ActiveX over the internet so even if it could be
determined by other means that the browser was IE 6 the script would
still not execute on it.
Just to add to the confusion, I recently read in a netscape.public .*
group of development work on ActiveX for windows Gecko browsers with a
new "GeckoActiveXOb ject" constructor. So maybe this script would not be
limited to just IE in the future. Though I got the impression that the
Gecko ActiveX support would be for custom ActiveX controls and not
Microsoft ones such a Word.Applicatio n.
Richard.
In article <bl************ *******@news.de mon.co.uk>, "Richard Cornford"
<Ri*****@litote s.demon.co.uk> writes: You can do it, reliably, neither on the server nor in the browser. Why does it matter what browser I am using? I assume that was intended to start "you can not do it, . . . ".
I think I put too many negatives in there. You can do it, reliably, neither on
the server or in the browser:
You can't do it reliably.
Same thing. I got too verbose on myself :(
<--snip--> I would have thought that, since the desire is to call the ActiveXObject constructor, the pertinent test would be for the existence of the ActiveXObjec t constructor:-
if(window.Acti veXObject){ // new ActiveXObject can be called. } -or- if(typeof ActiveXObject != 'undefined'){ // new ActiveXObject can be called. }
Thats what I was alluding to, but had no idea how to do it, never tried to :)
--
Randy
"HikksNotAtHome " <hi************ @aol.com> wrote in message
news:20******** *************** ****@mb-m11.aol.com... You can do it, reliably, neither on the server nor in the browser. Why does it matter what browser I am using? I assume that was intended to start "you can not do it, ... ".
I think I put too many negatives in there. You can do it, reliably, neither on the server or in the browser:
You can't do it reliably.
Same thing. I got too verbose on myself :(
<snip>
Its not as if I don't do that myself more often than I should.
(or do I? ;-)
Richard.
First of all, thanks to all for the assistances!
When I meant it didn't work, I saw on the left bottom corner right
above the toolbar, "Error on Page", after i click a button to do the
following function.
Lee <RE************ **@cox.net> wrote in message news:<bl******* *@drn.newsguy.c om>... Greener said: Hi, I need help badly. Can you do client-side programming instead of server-side to capture the Browser type info? If this is the case, what's wrong with the following?
<script language="JavaS cript"> function doWord(file) {
if (navigator.user Agent.indexOf(" MSIE")!=-1) { var w = new ActiveXObject(" Word.Applicatio n"); if (w != null) { w.Visible = true;
w.Documents.Ope n(file);
} } else { document.write( ...) }
} </script>
but it doesn't work. So I am wondering about what's wrong. Thanks for your advice.
It should have some sort of error handling code in case w == null, but other than that, it works for me. What do you mean when you say "it doesn't work". What does it do, instead of opening Word?
Thanks a lot. I tried to insert the following piece of code to my code
in several possible places: if(window.Activ eXObject){
// new ActiveXObject can be called.
}
<script language="JavaS cript">
function doWord(file)
{
if(window.Activ eXObject){
if (navigator.user Agent.indexOf(" MSIE")!=-1)
{
var w = new ActiveXObject(" Word.Applicatio n");
if (w != null)
{
w.Visible = true;
w.Documents.Ope n(file);
}
}
else
{
document.write( ...)
}
}
}
</script>
It still didn't work. Should I also try the other way you mentioned?
That is,
if(typeof ActiveXObject != 'undefined'){
// new ActiveXObject can be called.
}
What went wrong? How to make it work? Bear with me and sorry for my
ignorance.
"Richard Cornford" <Ri*****@litote s.demon.co.uk> wrote in message news:<bl******* ************@ne ws.demon.co.uk> ... "HikksNotAtHome " <hi************ @aol.com> wrote in message news:20******** *************** ****@mb-m11.aol.com... In article <9c************ *************@p osting.google.c om>, he********@yaho o.com (Greener) writes:
Hi, I need help badly. Can you do client-side programming instead of server-side to capture the Browser type info?
You can do it, reliably, neither on the server nor in the browser. Why does it matter what browser I am using?
I assume that was intended to start "you can not do it, . . . ".
If this is the case, what's wrong with the following?
The major problem is you are relying on an unreliable string to attempt to determine the browser.
<script language="JavaS cript"> function doWord(file) {
if (navigator.user Agent.indexOf(" MSIE")!=-1)
Not sure how to object test for ActiveX, never tried to. And there is probably a browser besides IE that will pass the following, but I am not sure:
Yes, Konqueror (so probably Safari), IceBrowser and Web Browser 2.0. In fact I think that test probably only rules out Opera and Gecko browsers as it seems to be common these days for non-IE browsers to be implementing a document.all collection.
if (document.all && document.getEle mentById &! window.opera){ alert('You might be using IE') } <snip>
I would have thought that, since the desire is to call the ActiveXObject constructor, the pertinent test would be for the existence of the ActiveXObject constructor:-
if(window.Activ eXObject){ // new ActiveXObject can be called. } -or- if(typeof ActiveXObject != 'undefined'){ // new ActiveXObject can be called. }
Following the principal that you feature/object test as close to the problem as possible.
However, with IceBrowser being an example of at least one browser that has a fake ActiveXObject constructor it becomes very important to test the object returned to ensure that it is an object. The OP's - if (w != null) - is a good start but it would also be worth checking that the object has the methods and properties that the script wants to call (eg. Documents.Open) in case the ActiveXObject constructor is a fake that just returns a standard JavaScript object.
But then there are the ActiveX user preferences. My IE 6 will not allow any scripting of ActiveX over the internet so even if it could be determined by other means that the browser was IE 6 the script would still not execute on it.
Just to add to the confusion, I recently read in a netscape.public .* group of development work on ActiveX for windows Gecko browsers with a new "GeckoActiveXOb ject" constructor. So maybe this script would not be limited to just IE in the future. Though I got the impression that the Gecko ActiveX support would be for custom ActiveX controls and not Microsoft ones such a Word.Applicatio n.
Richard.
Greener said: First of all, thanks to all for the assistances!
When I meant it didn't work, I saw on the left bottom corner right above the toolbar, "Error on Page", after i click a button to do the following function.
If you're writing JavaScript in Internet Explorer, you should configure
it to show you the details of your errors. I don't use IE often enough
to know how to do that, myself.
"Lee" <RE************ **@cox.net> wrote in message
news:bm******** @drn.newsguy.co m...
<snip> If you're writing JavaScript in Internet Explorer, you should configure it to show you the details of your errors. I don't use IE often enough to know how to do that, myself.
The quick way to activate IE error messages is to wait until the little
yellow triangle shows up in the browser status bar, double click on it
and, when the message box appears, check the "always show errors"
checkbox it contains.
Otherwise it is in one of the tabs under "Internet Options" in the menu.
Richard. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Greener |
last post by:
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...
|
by: Neal |
last post by:
Patrick Griffiths weighs in on the CSS vs table layout debate in his blog
entry "Tables my ass" - http://www.htmldog.com/ptg/archives/000049.php . A
quite good article.
|
by: lester |
last post by:
a pre-beginner's question:
what is the pros and cons of .net, compared to ++
I am wondering what can I get if I continue to learn C# after I have learned
C --> C++ --> C# ??
I think there must be many know the answer here.
thanks
|
by: Derek |
last post by:
Hello:
I want to capture the event when a browser is closing, to give to the user
the posibility of close or no this browser. When the browser is closing,
this show a confirm window with two buttons: Accept and Cancel.
When press the Accept button, the browser is closing, and when press the
Cancel button, the browser isn´t closing.
I...
|
by: Brett |
last post by:
What is the following code doing? I see evt and event but what is the difference?
<input type="radio" id="us_countryFlag1" name="us_country"
onclick="togglePurDec(event)">Yes
<script>
function togglePurDec(evt) {
evt = (evt) ? evt : event;
var target = (evt.target) ? evt.target : evt.srcElement;
| |
by: Paul |
last post by:
HI! I get an error with this code.
<SCRIPT language="JavaScript">
If (ifp==""){
ifp="default.htm"}
//--></SCRIPT>
Basicly I want my iframe to have a default page if the user enters in
directly. so I need a way doing this. so I check to see if the ifp value is
null and if so then assign it a value. is this correct?
|
by: Rajat Tandon |
last post by:
Hello there,
I am relatively new to the newsgroups and C#. I have never been disappointed
with the groups and always got the prompt replies to my queries.This is yet
another strange issue, I am facing. Please please help me to solve this as
soon as possible.
So here we go ...
I am not able to take the screen shot of the windows form...
|
by: karthik juneni |
last post by:
Hi all,
Iam trying to capture windows closing event (i.e) when the user clicks
on the "X" button i want to capture that event and want to update some
values in the database.I tried two methods but iam getting problems
with the two methods.
First,one i tried with
function Unload()
|
by: zerocostproduct |
last post by:
All,
Been a long time since I messed with VB my brother-in-law is taking a
intro programming class
he wrote the following code but he's getting an error at the
calculation line.
I no longer have VB and looking with my rusty eyes this code didn't
look like VB. After posting in a Visual basics group I was told it's
VB.net.
He's trying to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |