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

WebView does not load files in the same package

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • 8u72
    • 8u60
    • javafx
    • web
    • x86
    • windows_8

      FULL PRODUCT VERSION :
      java version "1.8.0_60"
      Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
      Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 10.0.10240]
      Win 10 not in the list!

      A DESCRIPTION OF THE PROBLEM :
      WebEngine does not load local package files linked in HTML via src or href directives.
      example:
      <script type="text/javascript" src="codemirror.js"></script>
      <link rel="stylesheet" href="codemirror.css">

      Additional info:
      http://stackoverflow.com/questions/32429069/loading-local-javascript-file-in-webview-in-java-8u60

      REGRESSION. Last worked in version 8u51

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create test.css file:
      body {
          background-color: green;
      }

      2. Create test.html file in the same packege:
      <html>
          <head>
              <title>TODO supply a title</title>
              <meta charset="UTF-8">
              <meta name="viewport" content="width=device-width, initial-scale=1.0">
              <link href="test.css" rel="stylesheet">
              <style>
                  body {
                      color: red;
                  }
              </style>
          </head>
          <body>
              <div>TODO write content</div>
          </body>
      </html>

      3. load HTML file to webview via:
      view.getEngine().load(this.getClass().getResource("test.html").toExternalForm());

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Page background should be green
      ACTUAL -
      Page background is white (default)

      REPRODUCIBILITY :
      This bug can be reproduced always.

            ghb Guru Hb (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: