FAQ Questions

R

Randy Webb

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.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.

<FAQENTRY>
 
R

Robert

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.body).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
 
R

Richard Cornford

Randy said:
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.
 
R

Randy Webb

Robert said:
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.body).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.
 
R

Randy Webb

Richard said:
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 :)
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).
 
R

Robert

Randy Webb said:
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/matlab/help211/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.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>';


I guess I will work on an innerHTML version that with all three line
endings.

Robert
 
M

Matt Kruse

javascript:'<code><ol><li>'+(document.documentElement||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?
 
T

Thomas 'PointedEars' Lahn

Robert said:
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/matlab/help211/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
 
M

Matt Kruse

Thomas said:
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.
 
R

Randy Webb

Thomas said:
Robert wrote:




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.

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.
 
T

Thomas 'PointedEars' Lahn

Matt said:
How else do you propose to create bookmarklets?
Duh.

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


PointedEars
 
R

Randy Webb

Thomas said:
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.
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top