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

WebView dont load additional files included in html files when files are in jar

XMLWordPrintable

    • web
    • x86_64
    • windows_7

      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 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      When application load html file from the jar, and html file contains links to other files in the jar (like css or javascripts), that other files are not loaded.

      This was working fine in previous Jave versions.

      REGRESSION. Last worked in version 8u51

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0_51"
      Java(TM) SE Runtime Environment (build 1.8.0_51-b16)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      WebViewTest .java

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.web.WebEngine;
      import javafx.scene.web.WebView;
      import javafx.stage.Stage;

      public class WebViewTest extends Application {
          
          @Override
          public void start(Stage primaryStage) {
          
              WebView browser = new WebView();
              WebEngine engine = browser.getEngine();
              engine.load(this.getClass().getResource("/index.html").toExternalForm());
              final Scene scene = new Scene(browser, 800, 650);

              primaryStage.setScene(scene);
              primaryStage.show();
          
          }


      index.html

      <!DOCTYPE html>
      <html>
          <head>
              <link rel="stylesheet" href="main.css" />
          </head>
          <body>
              <div class="test">TEST CSS</div>
          </body>
      </html>


      main.css

      .test {
          color: red;
      }



      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Move other resources to external location.


            jgiles Jonathan Giles
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: