Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8268866

Javascript when used in an iframe cannot display search results

XMLWordPrintable

    • b14
    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      All browsers tested have this problem (Chrome, Safari, Edge, Firefox)

      A DESCRIPTION OF THE PROBLEM :
      If a Javadoc URL is presented in an iframe it works well except for the search box. The search box will find matches, but if any of these are selected nothing happens. In the search.js code, line 346, one of two errors are presented. The most important case is when the javadoc is being generated locally so the frame and javadoc content have the same origin. In this case the error generated is 'undefined is not an object (evaluating 'parent.classFrame'). If instead one embeds an Oracle Javadoc page, once gets a security error.

      There are many use cases for displaying Javadoc in an iframe. For example, we generate javadoc from https://try.umple.org to help people understand their generated code.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Put the following code in an html file and open it, then search for something using the search box. Nothing will happen (this is the security error case). Substitute the oracle javadoc page for one generated locally from your own Java, and the same thing happens (this is the undefined (not an object) case.

      ```
      <html>
      <body>
      <h1>Test</h1>
      <iframe width=1000 height=1000 src="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/stream/IntStream.html"/>
      </body>
      </html>
      ```

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The expected result is that on clicking on a search result the relevant page will appear.
      ACTUAL -
      Nothing happens

      FREQUENCY : always


            hannesw Hannes Wallnoefer
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: