473,387 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

FAQ Questions

Just for my own curiosity, what ever happend to the Java Applet that was
referenced in the FAQ along with the HTTPRequestObject?
http://jibbering.com/faq/#FAQ4_34

And in http://jibbering.com/faq/#FAQ4_43, any chance of adding a snippet
about this bookmarklet:

javascript:'<code><ol><li>'+(document.documentElem ent||document.body).outerHTML.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/%20%20/g,"&nbsp;%20").replace(/\n/g,"<li>")+'<\/ol><\/code>';

I don't recall who wrote it, but it gives you the source of the
document, with line numbers, to make debugging in IE a lot simpler.

<FAQENTRY>
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #1
13 1477


Randy Webb wrote:
Just for my own curiosity, what ever happend to the Java Applet that was
referenced in the FAQ along with the HTTPRequestObject?
http://jibbering.com/faq/#FAQ4_34


I think the applet is here:
http://www.galasoft-lb.ch/shop_en.html
though I am not sure about that. And I don't edit the FAQ so I don't
know why the link is no longer there, maybe the restrictions to the free
version of the applet are a reason for that.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
> And in http://jibbering.com/faq/#FAQ4_43, any chance of adding a snippet
about this bookmarklet:

javascript:'<code><ol><li>'+(

document.documentElement||document.body).outerHTML .replace(
/&/g,"&amp;").replace(/</g,"&lt;").replace(/%20%20/g,"&nbsp;%20").replace(
/\n/g,"<li>")+'<\/ol><\/code>';

I think more testing would be needed on the MacOS version of IE. I
got only one line to display when I visited the Yahoo site. The yahoo
site has a javascript error today.

I picked this line up in this forum. I did not record the author. I
belive it would work with more browsers. It is a good way to display
the resulting html source if you are using document.write:

javascript:(document.documentElement||document.bod y).innerHTML.replace(
/&/g,%22&amp;%22).replace(
/</g,%22&lt;%22).replace(/\n/g,%22<br>%22)

You may need to delete the line ends when making it into a bookmark.

These lines would be a good addition to the FAQ.

Robert
Jul 23 '05 #3
Randy Webb wrote:
Just for my own curiosity, what ever happend to the Java
Applet that was referenced in the FAQ along with the
HTTPRequestObject?
http://jibbering.com/faq/#FAQ4_34
Did you mean:-

<URL: http://jibbering.com/faq/#FAQ4_38 >

- which has the link to the Galasoft applet?
And in http://jibbering.com/faq/#FAQ4_43, any chance of
adding a snippet about this bookmarklet:

javascript:'<code><ol><li>'+
(document.documentElement||document.body).
outerHTML.replace(/&/g,"&amp;").
replace(/</g,"&lt;").replace(/%20%20/g,"&nbsp;20").
replace(/\n/g,"<li>")+'<\/ol><\/code>';

I don't recall who wrote it, but it gives you the
source of the document, with line numbers, to make
debugging in IE a lot simpler.


As an addition to FAQ4_43 it would make most sense as part of a page on
client-side debugging strategies. However, I have often thought that it
might be a good idea to put a page of javascript URL together. A
collection that could include URLs useful for debugging, but also
examples of how they may be used to subvert things like javascript
validation (as a lesson in why client-side validation should not be used
on its own).

Richard.
Jul 23 '05 #4
Robert wrote:
And in http://jibbering.com/faq/#FAQ4_43, any chance of adding a snippet
about this bookmarklet:

javascript:'<code><ol><li>'+(


document.documentElement||document.body).outerHTML .replace(
/&/g,"&amp;").replace(/</g,"&lt;").replace(/%20%20/g,"&nbsp;%20").replace(
/\n/g,"<li>")+'<\/ol><\/code>';

I think more testing would be needed on the MacOS version of IE. I
got only one line to display when I visited the Yahoo site. The yahoo
site has a javascript error today.

I picked this line up in this forum. I did not record the author. I
belive it would work with more browsers. It is a good way to display
the resulting html source if you are using document.write:

javascript:(document.documentElement||document.bod y).innerHTML.replace(
/&/g,%22&amp;%22).replace(
/</g,%22&lt;%22).replace(/\n/g,%22<br>%22)


The only two differences in the two is that the first one numbers the
lines, which makes it a lot easier to see where a particular line number
is. The other difference is outerHTML versus innerHTML. Does outerHTML
work in IE on the MAC?

I believe mine and yours both came from the same thread though.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #5
Richard Cornford wrote:
Randy Webb wrote:
Just for my own curiosity, what ever happend to the Java
Applet that was referenced in the FAQ along with the
HTTPRequestObject?
http://jibbering.com/faq/#FAQ4_34

Did you mean:-

<URL: http://jibbering.com/faq/#FAQ4_38 >

- which has the link to the Galasoft applet?


Nah, I looked at the wrong one. Maybe thats why I didn't see it :)
And in http://jibbering.com/faq/#FAQ4_43, any chance of
adding a snippet about this bookmarklet:

javascript:'<code><ol><li>'+
(document.documentElement||document.body).
outerHTML.replace(/&/g,"&amp;").
replace(/</g,"&lt;").replace(/%20%20/g,"&nbsp;20").
replace(/\n/g,"<li>")+'<\/ol><\/code>';

I don't recall who wrote it, but it gives you the
source of the document, with line numbers, to make
debugging in IE a lot simpler.

As an addition to FAQ4_43 it would make most sense as part of a page on
client-side debugging strategies. However, I have often thought that it
might be a good idea to put a page of javascript URL together. A
collection that could include URLs useful for debugging, but also
examples of how they may be used to subvert things like javascript
validation (as a lesson in why client-side validation should not be used
on its own).


Yes, 4_43 would be a good place for it (or a link to it).

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #6
Randy Webb <Hi************@aol.com> wrote in message
The only two differences in the two is that the first one numbers the
lines, which makes it a lot easier to see where a particular line number
is. The other difference is outerHTML versus innerHTML. Does outerHTML
work in IE on the MAC?


I had to change the \n to \r to get this one line of Javascript to
work on MacOS 10.2.6 for IE 5.2.

javascript:'<code><ol><li>'+(
document.documentElement||document.body).outerHTML .replace(
/&/g,"&amp;").replace(/</g,"&lt;").replace(
/%20%20/g,"&nbsp;%20").replace(
/\r/g,"<li>")+'<\/ol><\/code>';
To mark the end of a line in a text file (...), the MacOS uses a
carriage return (CR, ASCII 13), UNIX uses a line feed (LF, ASCII 10)
while Windows uses a carriage return and a line feed (CRLF).
< http://mathstat.carleton.ca/~help/ma...xplatform.html >

Perhaps, we could include both the Mac and PC line end characters in
the same one liner.

I tried the following one liner and it seems to work on IE 5.0 on
Windows 98 and IE 5.2 on MacOS 10.2.6.

Curiously enough, I had to add more HTML tags to get this line to work
in IE 5.0 on Windows 98. I had to add the standard header stuff.

javascript:'<html><head><title>Source.file.listing <\/title><\/head><body><code><ol><li>'+(
document.documentElement||document.body).outerHTML .replace(
/&/g,"&amp;").replace(
/</g,"&lt;").replace(
/%20%20/g,"&nbsp;%20").replace(
/\r\n/g,"<li>").replace(
/\r/g,"<li>")+'<\/ol><\/code><\/body><\/html>';

Note: You will probably need to get this all on one line before
pasting into your browser. The one line version is:

javascript:'<html><head><title>Source file
listing<\/title><\/head><body><code><ol><li>'+(document.documentEleme nt||document.body).outerHTML.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/%20%20/g,"&nbsp;%20").replace(/\r\n/g,"<li>").replace(/\r/g,"<li>")+'<\/ol><\/code><\/body><\/html>';
I guess I will work on an innerHTML version that with all three line
endings.

Robert
Jul 23 '05 #7
Randy Webb wrote:

javascript:'<code><ol><li>'+(document.documentElem ent||document.body).outerH
TML.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/%20%20/g,"&nbsp;%20"
).replace(/\n/g,"<li>")+'<\/ol><\/code>';

Since IE reports line numbers incorrectly when js files are included in the
source, it might be cool to go request those js files and include them
in-line, also. Then the line numbers that IE reports might be more accurate,
no?

--
Matt Kruse
http://www.JavascriptToolbox.com
Jul 23 '05 #8
Matt Kruse wrote:
Randy Webb wrote:

javascript:'<code><ol><li>'+(document.documentElem ent||document.body).outerH
TML.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/%20%20/g,"&nbsp;%20"
).replace(/\n/g,"<li>")+'<\/ol><\/code>';

Since IE reports line numbers incorrectly when js files are included in the
source, it might be cool to go request those js files and include them
in-line, also. Then the line numbers that IE reports might be more accurate,
no?

This is a start on it, needs some more tweaking.

j='';k=document.scripts;for(i=0;i<k.length;i++){if (k[i].src){xmlhttp=
new ActiveXObject("Microsoft.XMLHTTP");xmlhttp.open("G ET",k[i].src,true);
xmlhttp.onreadystatechange=function(){if(xmlhttp.r eadyState==4)
{j=j+xmlhttp.responseText;}};xmlhttp.send(null)}}
re=/ /g;
s=document.createElement("script");s.src=j.replace (re,'\n');document.body.appendChild(s);

My IE uses the Microsoft.XMLHTTP; others may need to edit it to be
Msxml2.XMLHTTP in the ActiveXObject.

As written, its not replacing the expression. Another one of those bugs
to get out of it. If I alert it (j.replace(...)), then the \n is there.
But when it appends it, it converts it back <shrug>.

Even then, the line numbers are still worthless. Since it is written, at
the moment, to append it to the body.

I will add it to my list of "crap to do at midnight", to change it so
that it inserts the actual text of the external file into the page
itself. That might take a little work :)

If debugging an external file, I always put it in the document, debug
it, then move it back to an external file.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #9
Robert wrote:
Randy Webb <Hi************@aol.com> wrote in message
The only two differences in the two is that the first one numbers the
lines, which makes it a lot easier to see where a particular line number
is. The other difference is outerHTML versus innerHTML. Does outerHTML
work in IE on the MAC?
I had to change the \n to \r to get this one line of Javascript to
work on MacOS 10.2.6 for IE 5.2.

javascript:'<code><ol><li>'+(
document.documentElement||document.body).outerHTML .replace(
/&/g,"&amp;").replace(/</g,"&lt;").replace(
/%20%20/g,"&nbsp;%20").replace(
/\r/g,"<li>")+'<\/ol><\/code>';


Don't use javascript: URIs where you can avoid it. Particularly your
example creates invalid HTML.
To mark the end of a line in a text file (...), the MacOS uses a
carriage return (CR, ASCII 13), UNIX uses a line feed (LF, ASCII 10)
while Windows uses a carriage return and a line feed (CRLF).
< http://mathstat.carleton.ca/~help/ma...xplatform.html >

Perhaps, we could include both the Mac and PC line end characters in
the same one liner.


There is no need for different versions for Mac and PC. Perl Compatible
Regular Expressions, as supported by ECMAScript implementations, support
alternations:

var b = document && (document.documentElement || document.body);
if (typeof b.outerHTML == "string")
{
alert(
b.outerHTML
.replace(/&/g,"&amp;")
.replace(/</g,"&lt;")
.replace(/ /g,"&nbsp; ")
.replace(/(\r\n?|\n)/g, "<li>"));
}
PointedEars
--
The only thing worse than infinite recursion is infinite recursion.
Jul 23 '05 #10
Thomas 'PointedEars' Lahn wrote:
javascript:'<code><ol><li>'+(
document.documentElement||document.body).outerHTML .replace(
/&/g,"&amp;").replace(/</g,"&lt;").replace(
/%20%20/g,"&nbsp;%20").replace(
/\r/g,"<li>")+'<\/ol><\/code>';

Don't use javascript: URIs where you can avoid it. Particularly your
example creates invalid HTML.


How else do you propose to create bookmarklets?
Duh.

--
Matt Kruse
http://www.JavascriptToolbox.com
Jul 23 '05 #11
Thomas 'PointedEars' Lahn wrote:
Robert wrote:

Randy Webb <Hi************@aol.com> wrote in message
The only two differences in the two is that the first one numbers the
lines, which makes it a lot easier to see where a particular line number
is. The other difference is outerHTML versus innerHTML. Does outerHTML
work in IE on the MAC?
I had to change the \n to \r to get this one line of Javascript to
work on MacOS 10.2.6 for IE 5.2.

javascript:'<code><ol><li>'+(
document.documentElement||document.body).outerHTML .replace(
/&/g,"&amp;").replace(/</g,"&lt;").replace(
/%20%20/g,"&nbsp;%20").replace(
/\r/g,"<li>")+'<\/ol><\/code>';

Don't use javascript: URIs where you can avoid it. Particularly your
example creates invalid HTML.


If you had bothered to read the entire thread, you would have noticed
that it was the creation of a bookmarklet that would number the lines in
the source code of a page.

To mark the end of a line in a text file (...), the MacOS uses a
carriage return (CR, ASCII 13), UNIX uses a line feed (LF, ASCII 10)
while Windows uses a carriage return and a line feed (CRLF).
< http://mathstat.carleton.ca/~help/ma...xplatform.html >

Perhaps, we could include both the Mac and PC line end characters in
the same one liner.

There is no need for different versions for Mac and PC. Perl Compatible
Regular Expressions, as supported by ECMAScript implementations, support
alternations:

var b = document && (document.documentElement || document.body);
if (typeof b.outerHTML == "string")


Since the bookmarklet is for IE only, that test is not needed.
{
alert(
b.outerHTML
.replace(/&/g,"&amp;")
.replace(/</g,"&lt;")
.replace(/ /g,"&nbsp; ")
.replace(/(\r\n?|\n)/g, "<li>"));
}


That does not do what was needed. Read the thread, then try again.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #12
Matt Kruse wrote:
Thomas 'PointedEars' Lahn wrote:
javascript:'<code><ol><li>'+(
document.documentElement||document.body).outerHTML .replace(
/&/g,"&amp;").replace(/</g,"&lt;").replace(
/%20%20/g,"&nbsp;%20").replace(
/\r/g,"<li>")+'<\/ol><\/code>';

Don't use javascript: URIs where you can avoid it. Particularly your ^^^^^^^^^^^^^^^^^^^^^^ example creates invalid HTML.


How else do you propose to create bookmarklets?
Duh.


I have marked what is important here for
those who have difficulties with reading.
PointedEars
--
Eternal salvation or triple your money back!
Jul 23 '05 #13
Thomas 'PointedEars' Lahn wrote:
Matt Kruse wrote:
Thomas 'PointedEars' Lahn wrote:
javascript:'<code><ol><li>'+(
document.documentElement||document.body).outerHTML .replace(
/&/g,"&amp;").replace(/</g,"&lt;").replace(
/%20%20/g,"&nbsp;%20").replace(
/\r/g,"<li>")+'<\/ol><\/code>';

Don't use javascript: URIs where you can avoid it. Particularly your ^^^^^^^^^^^^^^^^^^^^^^example creates invalid HTML.

How else do you propose to create bookmarklets?
Duh.

I have marked what is important here for
those who have difficulties with reading.


What you missed is the whole topic of this thread, which is bookmarklets
and how to come up with a way to make IE easier to debug. Now, if you
can come up with a way to use that script, from the address bar, without
using a javascript URI, then you might have a case. Until then, please
STFU, RTFM, and move on.

Normal course of action:

1) Open Mouth
2) Insert Foot
3) Be notified of it
4) Remove foot
5) Thank the person who notified
6) Complain of taste

Thomas Lahn's Course of Action:

1) Open Mouth
2) Insert Foot
3) Be notified of it
4) Insist it tastes good, insert foot further

And he wonders why most think he is anally retentive. Sheesh.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #14

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

Similar topics

0
by: softwareengineer2006 | last post by:
All Interview Questions And Answers 10000 Interview Questions And Answers(C,C++,JAVA,DOTNET,Oracle,SAP) I have listed over 10000 interview questions asked in interview/placement test papers for...
0
by: connectrajesh | last post by:
INTERVIEWINFO.NET http://www.interviewinfo.net FREE WEB SITE AND SERVICE FOR JOB SEEKERS /FRESH GRADUATES NO ADVERTISEMENT
2
by: freepdfforjobs | last post by:
Full eBook with 4000 C#, JAVA,.NET and SQL Server Interview questions http://www.questpond.com/SampleInterviewQuestionBook.zip Download the JAVA , .NET and SQL Server interview sheet and rate...
4
by: Drew | last post by:
I posted this to the asp.db group, but it doesn't look like there is much activity on there, also I noticed that there are a bunch of posts on here pertaining to database and asp. Sorry for...
8
by: Krypto | last post by:
Hi, I have used Python for a couple of projects last year and I found it extremely useful. I could write two middle size projects in 2-3 months (part time). Right now I am a bit rusty and trying...
0
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
1
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
0
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
0
by: reema | last post by:
EJB Interview Questions http://interviewdoor.com/technical/EJB-Interview-Questions.htm CSS Interview Questions http://interviewdoor.com/technical/CSS-Interview-Questions.htm C Interview Questions...
0
by: reema | last post by:
EJB Interview Questions http://interviewdoor.com/technical/EJB-Interview-Questions.htm CSS Interview Questions http://interviewdoor.com/technical/CSS-Interview-Questions.htm C Interview Questions...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
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...

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.