In comp.lang.javascript message <20ecde0b-c4e3-44df-9e34-a447753b0fb9@g1
6g2000yqa.googlegroups.com>, Thu, 20 Oct 2011 17:13:28, Antony Scriven
In Firefox, for example, you might be able to do something
with e.stack:
<html>
<body>
<script id="foo">
var f = function(){
try{
qwoazlskjfalksdtjo4tjwf();
}catch(e){
alert(e.stack);
alert(window.documentElement.innerHTML);
}
};
</script
<script id="bar">
f();
</script>
</body>
</html>
As posted, that shows f(); in the window in FF 7.0.1 Win XP sp3.
After the obvious repair, it gives the first alert, then the error
message
Error: window.documentElement is undefined
Source File: file:///C:/HOMEPAGE/$1.htm Line: 10
What's your goal? --Antony
The alert routine always used to pop up s simple dialogue, which could
be dragged around. Except for Opera, it was alas in the small font used
by Windows for the main menu bar. The page issuing the alert was
unchanged, apart from having lost focus.
A few updates ago, Opera changed to giving a non-standard but still
draggable alert dialogue, and greying the page into near unreadability -
which is bad if the alert is reporting details of an input error as is
commonly the case. It retained the more readable font. My easy fix was
to not use Opera for such pages.
Since my most recent Firefox upgrade, from 3.6.23 to 7.0.1, FF's alert
is like opera's, except that it is not draggable (so may cover what one
wants to read) and uses the hard-to-read font.
My Web site has, counting with MiniTrue, 566 calls of alert.
So I was thinking of replacing window.alert with another function Alert
or by editing replace calls of alert with ones of Alert by editing the
source (with MiniTrue). The new function Alert would insert a suitable
box somewhere on the page. In practice, inserting before or after the
script element could be a good default (a second argument, if provided,
would choose a location). Alternatively, the function Alert could open
a new window.
The same would apply to window.confirm and window.prompt.
<FAQENTRY> replacement for alert confirm prompt </FAQENTRY>