如何告诉JavaFXWebView忽略';使用严格的';指令?
我尝试使用以下代码将mozilla viewer集成到JavaFx WebView中:如何告诉JavaFXWebView忽略';使用严格的';指令?,java,javafx,webkit,mozilla,pdfjs,Java,Javafx,Webkit,Mozilla,Pdfjs,我尝试使用以下代码将mozilla viewer集成到JavaFx WebView中: import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.web.WebView; import javafx.stage.Stage; public class TestStrict extends Application { @Over
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
public class TestStrict extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
WebView webView = new WebView();
String url = TestStrict.class.getClassLoader().getResource("pdfjs-1.1.366-dist/web/viewer.html").toExternalForm();
webView.getEngine().load(url);
Scene scene = new Scene(webView);
primaryStage.setScene(scene);
primaryStage.setWidth(800);
primaryStage.setHeight(600);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
pdfjs-1.1.366-dist文件夹可从以下位置下载:
我还更改了viewer.html
,只是在其中添加了firebug lite:
<script type='text/javascript' src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
现在,当我运行应用程序时,我得到了查看器框架,但没有加载默认的pdf,以下错误在firebug控制台中:
TypeError:undefined不是对象(正在计算'globalScope.PDFJS')(pdf.worker.js,103)
我删除了javascript文件中的所有“use strict”指令,一切正常
我不知道这是否是JavaFX或内部WebKit中的错误,但它发生在1.8.0_60版本中
有没有办法禁用严格模式,因为在无法控制脚本和删除“使用严格”指令的情况下,将加载其他网页?