Can not make GWT application work as Chrome packaged app, probably due to CSP

前端 未结 4 929
北恋
北恋 2020-12-31 18:23

Keep getting CSP errors: \"Refused to execute inline script because it violates the following Content Security Policy directive: \"script-src \'self\'\"

The problem

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-31 19:08

    Thanks to Thomas Broyer's advice. I created this GWT Linker. Now my GWT application runs perfectly as an Chrome Application (Tested on Chrome 32 and GWT 2.5.1).

    public class CSPCompatibleLinker extends DirectInstallLinker {

    @Override
    protected String getJsInstallLocation(LinkerContext context) {
        return "com/google/gwt/core/ext/linker/impl/installLocationMainWindow.js";
    } 
    

    }

    Dont forget to declare the Linker into your*.gwt.xml file:

    
    
    

提交回复
热议问题