/** * Check if Content Security Policy Level 2 is supported by the browser Currently, IE, Edge and * Opera Mini browsers don't support CSP2 as per http://caniuse.com/#feat=contentsecuritypolicy2 * * @return true if user agent used in req supports CSP2 */ private boolean isCSP2Supported(final HttpServletRequest req) { final String userAgent = req.getHeader("User-Agent"); if (userAgent == null) { return false; } final int browser = BrowserUserAgent.parseBrowser(userAgent); if (UserAgent.IE.match(browser)) { // UserAgent.IE is used for IE11 and IE12 (Edge) return false; } return true; }