Internet Explorer Bug when displaying javadocs - Solution

Discussion in 'Java' started by Torsten Nahm, Nov 7, 2003.

  1. Torsten Nahm

    Torsten Nahm Guest

    Hi,

    this is a solution I found to a problem I posted about some time ago:

    > From: (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
     
    Torsten Nahm, Nov 7, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. cmay
    Replies:
    0
    Views:
    1,136
  2. NewTel
    Replies:
    2
    Views:
    483
    G. Whiz
    Feb 23, 2006
  3. Ed Hauptman
    Replies:
    7
    Views:
    1,025
    Ed Hauptman
    Aug 7, 2009
  4. datagrid not displaying on internet explorer

    , Apr 25, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    116
  5. John Smith
    Replies:
    1
    Views:
    146
    Evertjan.
    Mar 12, 2005
Loading...

Share This Page