Internet Explorer Bug when displaying javadocs - Solution

T

Torsten Nahm

Hi,

this is a solution I found to a problem I posted about some time ago:
From: (e-mail address removed) (Torsten Nahm)
Newsgroups: comp.lang.java.programmer
Subject: Internet Explorer Bug when displaying javadocs
Date: 21 Sep 2002 09:31:50 -0700

Hi,

I need to use the Internet Explorer to display javadoc, as it is
integrated into the Eclipse environment. The details pages by
themselves (e.g. j2sdk1.4.0\docs\api\overview-summary.html) will
display just fine, however as soon as they are embedded in frames
(e.g. j2sdk1.4.0\docs\api\index.html), the details page will not
display fully. What happens is that the frame contents are formatted
in such a way that they are always about 20 pixels too large in width
to fit the space allocated for the frame. I've put up a picture at
http://cips01.physik.uni-bonn.de/~nahmt/javadoc.jpg.

The solution I offer is a hack, and does not address the fundamental
issues with the Internet Explorere, but it works fine for me.

The basic problem seems to be the rendering of specifically HTML 4
documents in the Internet Explorer. Javadoc files start of with the
header
"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">", making
IE identify them as HTML 4.

When I changed "DTD HTML 4.0" to "DTD HTML 3.0", the document renders
correctly. Thus, IE recognizes HTML 4 headers and then uses a
different (and for javadocs inferior) rendering mode.

Thus, a first quick fix is to do a replacement of "DTD HTML 4.0" to
"DTD HTML 3.0" in the DOCTYPE headers for all your javadocs.

This fix is only of limited use, though, as new javadocs (for example
those generated for your code) will have the HTML 4 header again. To
solve the problem permanently, quite a bit more work is required. I
present a solution in two steps:

1) You will need a proxy capable of modifying the DOCTYPE header of
the HTML files passing thru it. I use Proxomitron
(www.proxomitron.info), which I have also found to be a superior ad
blocker. For Proxomitron, I created a rule called "Javadoc IE Hack" as
a Web Filter. It has the following attributes:

Allow for multiple matches: Checked
Bounds Match: ""
Byte Limit: "256"
URL Match: "127.0.00.1" (sic! - why the "00" this will be explained
later)
Matching Expression: " <!DOCTYPE\1DTD HTML 4.0\2>" (the leading space
is required, though I don't know why)
Replacement Text: "<!DOCTYPE\1DTD HTML 3.0\2>"

If you now activate the rule, the replacement system is in place.

2) Now you need to set Eclipse so that it uses this proxy for
accessing the javadocs. In Eclipse 2.1, this is set in the preferences
under Help/Help Server. Set the host ip address to "127.0.00.1"
(sic!), the port for the server to listen on is left at "0". In
earlier Eclipse versions, the setting might not be accessible thru the
preferences, but can be found in the plugins directory.

Eclipse will now use your local proxy to access the javadocs, which
performs the DOCTYPE modification.


The reason for the strange double 0 in "127.0.00.1" is the following.
If the IE is told to get a file from a server at 127.0.0.1, it figures
since this is localhost, it won't use the proxy. It thus bypasses the
proxy, and no DOCTYPE modification takes place. The easiest way to get
by this is to use a string like "127.0.00.1". IE is now tricked into
not recognizing the address as localhost (being as stupid as it is
;-), and naively uses the proxy, leading to the desired result.

Best,
Torsten

tnahm (at) web (dot) de
 

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

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top