JDK-8139123 : WebView does not load files in the same package
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 8u60
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_8
  • CPU: x86
  • Submitted: 2015-10-07
  • Updated: 2016-09-20
  • Resolved: 2015-10-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8u72Resolved
Related Reports
Duplicate :  
Description
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.


Comments
Fixed with JDK-8136466 , Back ported to 8u72 (JDK-8138773)
08-10-2015

Could be a duplicate of JDK-8136466.
08-10-2015