473,765 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

developing with / for internet explorer

Hello,

I created some rather complex Intranet Application, using lots of
JavaScript, DOM-Maninpulation and XMLHTTPRequest communication.

I developed on FireFox, with the excellent firebug ... every misstake
was given back with a fine, fine traceback; exactly pointing to the
code at error.

My code runs fine on FireFox and Opera.

Now some people demand to have that application running with Internet
Explorer; and it fails at the syntax check of the JavaScript. That
surely should be fixable, but the bigger problem is:

Internet Explorer just gives me an error box with some rather bogus
line and character where he detected the error.

Enabling debugging and installing the scriptdebugger from Microsoft
(which, oddly enough, only runs with admin privileges), gives me a
debugging window. And: at each error the MochiKit main JS File is
opened at the beginning.

I am rather sure that the errors are within my JavaScript, not in
MochiKit.

So I am crying out for help: How do you resolve JS errors with Internet
Explorer? Is there any secret weapon to get at least usable line
numbers; or even a traceback of an error?

I do NOT need a full blown debugger, allowing me to single step and
all. Just "this line caused your error" with a usable "this" would be
enough.

Any suggestions?

Harald

Jul 15 '06 #1
11 2029
GHUM wrote:
<snip>
Internet Explorer just gives me an error box with some
rather bogus line and character where he detected the
error.
Superficially that is the impression given by the IE error messages.
However, while the error messages do usually show incorrect line
numbers, for example, they are consistently incorrect (as you would
expect from software (consistency not necessarily incorrectness), and
the messages themselves consistently relate to the issue raising the
error, even if they are not always that specific about what the error
is. For example, "xxx.yyy is null or not an object" always means that
xxx did not resolve as a reference to an object so a 'yyy' property
could not be looked up on that object, "object expected" is an attempt
to call a function where the Identifier for the function did not resolve
into an object, and "'xxx' is undefined" is an attempt to reference an
Identifier where the Identifier has not been declared. The messages
themselves may not be particularly obvious but their relationships with
their causes is consistent and can be learnt with experience.

<snip>
I am rather sure that the errors are within my JavaScript,
not in MochiKit.
Although I would not trust Microsoft's script debugger, I have seen
considerable amounts of time being wasted by people being certain that
the problem did not lie in the locations where automated tools said they
were, and where they actually turned out to be in the long run.
So I am crying out for help: How do you resolve JS errors
with Internet Explorer? Is there any secret weapon to get
at least usable line numbers; or even a traceback of an error?
<snip>

Apart form observing some patterns, such as that errors in event handing
functions internally generated from Intrinsic event attribute values
invariably claim to be on line one, learning which errors are caused by
which issues will tell you what type of thing you are looking for, and
actually locating the offending line can usually be achieved by applying
logic to the question.

Because the error output is consistent, modifying the input and seeing
how the output changes can be used to make deductions about the error's
location. For example, suppose you have an HTML page with embedded
javascript and two imported javascript files, and an error reported on
line 45. If you go to the javascript files and add one blank line to the
top of one and two blank lines to the top of the other and re-load and
reproduce the error, if the line number is now 47 the issue is in the
second javascript files, 46 and it is in the first, and still 45 means
the issue is in the HTML page code, on or about line 45.

Similarly, finding the exact line of code in a javascript file; If the
error report says line 45 the actual error will be in the immediate
vicinity of line 45, but not necessarily on that line. You go to, say,
line 42 and add a blank line after it, skip the next line of code and
add another blank line, skip the next line of code and add another
blank, and so on, inserting say 6 blank lines. If re-producing the error
now claims that it is on line 48 you know exactly which line it is on
because it is the line following the third blank line inserted.

Richard.
Jul 15 '06 #2
JRS: In article <e9************ *******@news.de mon.co.uk>, dated Sat, 15
Jul 2006 13:45:06 remote, seen in news:comp.lang. javascript, Richard
Cornford <Ri*****@litote s.demon.co.ukpo sted :
>
Similarly, finding the exact line of code in a javascript file; If the
error report says line 45 the actual error will be in the immediate
vicinity of line 45, but not necessarily on that line. You go to, say,
line 42 and add a blank line after it, skip the next line of code and
add another blank line, skip the next line of code and add another
blank, and so on, inserting say 6 blank lines. If re-producing the error
now claims that it is on line 48 you know exactly which line it is on
because it is the line following the third blank line inserted.

That's not necessarily the location of the real error; it's the location
where Javascript realises that an error has occurred.

Consider the error of not uncommenting a declaration :

// var x
/* */
x

The error is in the first line, but reported on the third.

I expect other examples can be found in which the actual error is well
before where the presence of an impossibility is detected.

a = b = 1

c = a /* b // but message is clear

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/>? JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 15 '06 #3
Dr John Stockton wrote:
>
That's not necessarily the location of the real error; it's the
location where Javascript realises that an error has occurred.
If only full static analysis was available!

Failing that, jslint is a good tool to have in your arsenal:

http://www.jslint.com/lint.html

Joshua
Jul 16 '06 #4
Dr John Stockton said the following on 7/15/2006 6:30 PM:
JRS: In article <e9************ *******@news.de mon.co.uk>, dated Sat, 15
Jul 2006 13:45:06 remote, seen in news:comp.lang. javascript, Richard
Cornford <Ri*****@litote s.demon.co.ukpo sted :
>Similarly, finding the exact line of code in a javascript file; If the
error report says line 45 the actual error will be in the immediate
vicinity of line 45, but not necessarily on that line. You go to, say,
line 42 and add a blank line after it, skip the next line of code and
add another blank line, skip the next line of code and add another
blank, and so on, inserting say 6 blank lines. If re-producing the error
now claims that it is on line 48 you know exactly which line it is on
because it is the line following the third blank line inserted.


That's not necessarily the location of the real error;
If that is your criteria, then you will *never* know the location of the
real error.
it's the location where Javascript realises that an error has occurred.
And that is all you can expect from the browser.
Consider the error of not uncommenting a declaration :

// var x
/* */
x

The error is in the first line, but reported on the third.
Technically speaking, the error is on the third line, not the first. The
first line may be an error by not uncommenting it but having a commented
line is not an error.

But, the above is an example of a human error, not a JS error with
regards to the first/third line.
I expect other examples can be found in which the actual error is well
before where the presence of an impossibility is detected.
Absolutely. Object Expected Line 0 Character 0.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 16 '06 #5
GHUM wrote:
Enabling debugging and installing the scriptdebugger from Microsoft
(which, oddly enough, only runs with admin privileges), gives me a
debugging window. And: at each error the MochiKit main JS File is
opened at the beginning.
Any suggestions?
I have 2 suggestion:
1. Microsoft Script Debugger have a "Call stack" window, check each
item, maybe that will help you to understand what cause the error.
2. Put the "debugger;" line somewhere in the beggining of you
application and execute your application line by line(F8 - Step Into),
this way you must find the exact line of the error.

--
Best regards,
Nicolae Namolovan.

Jul 16 '06 #6
Richard,

thank you very much for your detailed mail!

Still, within my first reading, I still was hoping that somewhere
around the end you would write something along "ha-ha! I have been
joking! just download IEerrorConsole. activex from somewhere and you are
fine"
However, while the error messages do usually show incorrect line
numbers, for example, they are consistently incorrect
Thanks, that answer alone and the trick with:
Because the error output is consistent, modifying the input and seeing
how the output changes can be used to make deductions about the error's
location.
really helped me to get some steps forward!

is. For example, "xxx.yyy is null or not an object" always means that
xxx did not resolve as a reference to an object so a 'yyy' property
could not be looked up on that object, "object expected" is an attempt
to call a function where the Identifier for the function did not resolve
into an object, and "'xxx' is undefined" is an attempt to reference an
Identifier where the Identifier has not been declared. The messages
themselves may not be particularly obvious but their relationships with
their causes is consistent and can be learnt with experience.
That really helped a lot, thank you! Does somebody know more
translations from "Microsoft" to English? Or German?

I can contribute something: From MochiKit:

GetElementsByTa gAndClassName(' tag', 'class', parent='content ') fails,
not because it is implemented in MochiKit AND in the IE-Javascript, but
because of the parent= ... IE seems not to support named parameters.
You go to, say,
line 42 and add a blank line after it, skip the next line of code and
add another blank line, skip the next line of code and add another
blank, and so on, inserting say 6 blank lines. If re-producing the error
now claims that it is on line 48 you know exactly which line it is on
because it is the line following the third blank line inserted.
Thanks you very much for pointing this out. It works, thank you!

But I still feel this is so 1980ish to find the offending line via
inserting blanks; especially
knowing that Microsoft is one of the leading suppliers of Software
Development Tools. It's a shame, definitely.

Harald

Jul 16 '06 #7
JRS: In article <n7************ *************** ***@comcast.com >, dated
Sun, 16 Jul 2006 01:29:28 remote, seen in news:comp.lang. javascript,
Randy Webb <Hi************ @aol.composted :
>Dr John Stockton said the following on 7/15/2006 6:30 PM:
>JRS: In article <e9************ *******@news.de mon.co.uk>, dated Sat, 15
Jul 2006 13:45:06 remote, seen in news:comp.lang. javascript, Richard
Cornford <Ri*****@litote s.demon.co.ukpo sted :
>>Similarly, finding the exact line of code in a javascript file; If the
error report says line 45 the actual error will be in the immediate
vicinity of line 45, but not necessarily on that line. You go to, say,
line 42 and add a blank line after it, skip the next line of code and
add another blank line, skip the next line of code and add another
blank, and so on, inserting say 6 blank lines. If re-producing the error
now claims that it is on line 48 you know exactly which line it is on
because it is the line following the third blank line inserted.


That's not necessarily the location of the real error;

If that is your criteria, then you will *never* know the location of the
real error.
You mean "criterion" , the singular form.

It is essential to determine the location of the real error, because
that is where the correction needs to be made.
>it's the location where Javascript realises that an error has occurred.

And that is all you can expect from the browser.
Of course; but Richard's words were claiming that to be the location of
the actual error.

Richard's method, which I sometimes need myself, is good for determining
the line containing the point at which the code ceased to be possibly
valid; that's all.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/>? JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 16 '06 #8
GHUM wrote:
<snip>
>... , "object expected" is an attempt to call a function
where the Identifier for the function did not resolve
into an object, and "'xxx' is undefined" is an attempt
to reference an Identifier where the Identifier has not
been declared. The messages themselves may not be
particularly obvious but their relationships with their
causes is consistent and can be learnt with experience.

That really helped a lot, thank you! Does somebody know
more translations from "Microsoft" to English? Or German?
I am not aware of such a list, but part of my pint was that with a good
understanding of how javascript works the actual messages IE issues are
not actually that obscure. For example, when you call a function that is
not declared (say, miss spell/type the function name) Mozilla/Gecko
browser will say - 'xxx' is not a function - while IE will announce
object expected. But when you discover that the offending code is a
function call, and armed with the understanding that functions are
objects and to call a function, so some referenced must be first
resolved into an object _and_then_ that object must turn out to be
callable (have an internal [[Call]] method) it is not so surprising that
IE kicks out an error message at the point of discovering that the
reference did not resolve as an object, and so the message is couched in
terms of object and not functions.
I can contribute something: From MochiKit:

GetElementsByTa gAndClassName(' tag', 'class', parent='content ')
fails, not because it is implemented in MochiKit AND in the
IE-Javascript, but because of the parent= ... IE seems not to
support named parameters.
Named parameters? Javascript (any ECMA 3 rd Ed (or earlier).
implementation, including JScript <= 5.6) has no notion of named
parameters beyond the formal parameter list declarations (a comma
separated list of zero or more Identifiers) that appear in function
declarations and function expressions.

The - parent='content ' - above is an assignment expression. It assigns a
string value to a scope-resolved property with the name 'parent', and if
no other object on the scope chain has a property called 'parent' it
will be resolved as the 'parent' property of the global/window object.
It is normal for browser environment hosts to provide a 'parent'
property of the global/window object that is used to hold a reference to
the global/window object of the frame containing the (first)
global/window object's frame in a frameset, or the current global/window
if there is no frameset (or IRAMEs in the parent). This is why IE is
complaining as it does not allow this value to be re-assigned (and it is
optionally allowed to do that by specification).

Assignment expressions are allowed in the arguments list used in a
(function) call expression, indeed the (optional) ArgumentsList is
formally defined as a comma separated list of one or more
AssignmentExpre ssions, though the AssignmentExpre ssion is a category of
expressions that goes well beyond actual assignment operations. In a
call expression the AssignmentExpre ssions are evaluated and it is the
result of that evaluation is passed to the function call as its
argument. An assignment operation evaluates as the value assigned so -
parent='content ' evaluates as the string 'content', and the assignment
of the value to the 'parent' property of some object on the scope chain
is a side effect (desirable or otherwise).

If the notion here is that the Identifier - parent - can then be used
within the function called to refer to the argument then in may cases it
can, but the mechanism then has nothing to do with the arguments to the
function call. Instead the side effect of assigning the value to what is
in effect a global variable is mirrored by the fact that the use of an
undeclared (as a formal parameter, inner function declaration or local
variable name) Identifier will also result in resolution against the
scope chain with a high probability of the result being a reference to
the same global variable as the value had been written to during the
evaluation of the arguments to the function call. So once again a
misconception about how javascript works can avoid being exposed because
the code that employs it seems to 'work', at least up to the point where
it doesn't work.

It worries me that you have described this as 'named parameters' and I
wonder where you got that idea. I hope that the alarm bells are now
ringing and you can now see that you have identified a source of
information that is not reliable (is fundamentally mistaken about the
nature of javascript). You have not explained what this 'MochiKit' is,
or what relevance it has, but if it is the source of the 'named
parameters' suggestion you need to be questioning the competence of the
people responsible.

<snip>
But I still feel this is so 1980ish to find the offending
line via inserting blanks;
I tend to be pragmatic, if something tells me what I need to know in
return for (literally in most cases) a few seconds work then I am not
going to worry that it doesn't seem so sophisticated.
especially knowing that Microsoft is one of the leading
suppliers of Software Development Tools. It's a shame,
definitely.
Remember the role of marketing in business. It is not about finding out
what people what, it is about finding out how little can be got away
with, because no business can make a profit by giving people what the
want. Microsoft is a very successful business.

Richard.
Jul 17 '06 #9
Richard,
while IE will announce object expected. But when you discover that
the offending code is a
function call, and armed with the understanding that functions are
objects and to call a function, so some referenced must be first
resolved into an object _and_then_ that object must turn out to be
callable (have an internal [[Call]] method) it is not so surprising that
IE kicks out an error message at the point of discovering that the
reference did not resolve as an object, and so the message is couched in
terms of object and not functions.
Thank you very much for this explanation! You did not give me
additional vocabulary, but instead gave me an insight into the grammar
:) That way of thinking will really help.
IE-Javascript, but because of the parent= ... IE seems not to
support named parameters.
Named parameters? Javascript (any ECMA 3 rd Ed (or earlier).
implementation, including JScript <= 5.6) has no notion of named
parameters beyond the formal parameter list declarations (a comma
separated list of zero or more Identifiers) that appear in function
declarations and function expressions.
Uuups. So I just happened to abuse an assignment. Those "named
parameters" come from Python, where I do most of my development.
I grew to use those named parameters, because they help me understand
function calls years after the initial development of them.
It is normal for browser environment hosts to provide a 'parent'
property of the global/window object that is used to hold a reference to
the global/window object of the frame containing the (first)
global/window object's frame in a frameset, or the current global/window
if there is no frameset (or IRAMEs in the parent).
Good. So if in the interface description somebody would have named the
3rd parameter "upperlevelelem ent" or similiar, I would not have
stumbled accross that error for ages.
It worries me that you have described this as 'named parameters' and I
wonder where you got that idea.
You have not explained what this 'MochiKit' is,
or what relevance it has,
MochiKit is definitely not the "source" of that "named parameters"
idea. Those "parameter names" are used for the interface description,
giving something like:

getElementsByTa gAndClassName(t ag,class,[parent])

which is a rather usual description of a function interface. It was
clearly my mistake to keep the "parent"... the reasoning was: "of
course parameter 1 is a TAG, and 2 is a CLASS... if the function is
called "by Tag and Class". But will I really know what the 3rd
parameter is on first sight after 6months? So to save me from looking
up the definition, I used this "named parameter", and it worked out
fine. Or rahter, it seemed to work out fine. MochiKit itself is a
really well documented JavaScript library at www.mochikit.com;
developed mainly by Bob Ipollito.

And clearly, there is no suggestion that "you can use named parameters
with Javascript" anywhere in MochiKit. Just those innocent and usual
Api-definitions.

The only thing MochiKit would be to "blame" of is that it makes
JavaScript often feel like Python - which is feel as a good thing,
because it makes me feel at home. So, feeling "at home" I did as I do
"at home".

Thanks again for that explanation, and in the long run I am happy to
have tried to use "named parameters", because it gave me the
opportunitie to learn a lot by reading your explanation.

Harald

Jul 17 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2677
by: Raymond H. | last post by:
Hello, I create a vb4 project which can also naviger on Internet via the WebBrowser control which I put on my form. My question is: if this program is installed on a station having already Internet Explorer in it then will it cause an error if version Internet Explorer is the same one as WebBrowser which is in my project? Is it this control which Internet Explorer uses? If that can cause errors of version then, instead, can I install this...
12
19615
by: SunshineGirl | last post by:
I'm trying to receive events from a running instance of Internet Explorer. So far I've only been able to receive events from an instance I launch from code, but I need to receive events from all running instances of Internet Explorer (I mean those that the user launches himself). I know this is possible because I did it three months ago. Unfortunately, I can't find the code. I've already looked at all the Microsoft articles on automating...
0
1247
by: asadhussain | last post by:
I wrote a plugin to internet explorer that requires internet explorer to be shutdown and restarted. I figured out a way to shut down IE using the MSI and to start it back up using VBScript. I was wondering if there was a way to remember what webpage each internet explorer process was on and then open up internet explorer windows that open up to the URLs that the user was visiting previously. Any insights?
2
2295
by: CathieC | last post by:
I have a websote developed using visual studio 2005 beta , .net version 2 i deploy my application to a server and it is run from client computers. One of the users gets the error "Internet Explorer cannot open the internet site "XXXXX" Operation aborted" this happens when they click on a menu item to open a page. they do not get
3
2349
by: VK | last post by:
Internet Explorer 7 beta 2 preview CNET Editor review: <http://reviews.cnet.com/Internet_Explorer_7_for_XP_SP2_Beta_2/4505-3514_7-31454661-2.html?tag=nl.e415> Summary (my personal review interpretation): "Half stolen from Firefox, half is buggy - including the stolen part". Download: <http://www.download.com/Internet-Explorer-7/3000-2356_4-10497433.html?tag=nl.e415>
11
11625
by: Wendy | last post by:
Hello, I have a program that does the following: When a user clicks on a row in a VB.NET datagrid, it will open a web page in Internet Explorer (that corresponds to that item in the selected row in the datagrid). It will automatically print that web page, and then it will close the Internet Explorer window. I have code that works perfectly when a regular web page is opened, however when a pdf web page is opened the printing never...
3
11498
by: laredotornado | last post by:
Hi, This problem only affects PC IE. On a secured page (a page visited via https), there is a link that reads -- "Download HTML File". The link connects to this page <?php require("../../util_fns.php"); session_start();
9
7730
by: Etayki | last post by:
Hi! I am new to VB.net and I am using the Visual Basic 2005 Express Edition I have two questions: 1. I am trying to write an application that will automate Internet Explorer and store data in a database. Am I better off learning VB.net or C#.net? Is there a free development environment for C# as well?
1
2458
by: -Lost | last post by:
This is more of a post to inform, unless of course I am missing something fundamental, in which case I would appreciate anyone explaining it. Based on Mr. Michaux's camelizeStyle function I wrote: function create_style(style) { var p = document.createElement('p'); var t = document.createTextNode('Just something to fill the P.');
0
9568
marktang
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10156
Oralloy
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9951
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6649
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5419
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
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
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.