Thursday, August 8, 2013

Checking of Broswer type on ViewModel in ZK Framework.

private String checkBrowserType() {
        String browserType = "";
        String userAgent = Executions.getCurrent().getUserAgent();
        if (userAgent != null && userAgent.length() > 0) {
            if (userAgent.contains("MSIE")) {
                browserType = "IE";
            } else if (userAgent.contains("Firefox")) {
                browserType = "Mozilla";
            } else if (userAgent.contains("Chrome")) {
                browserType = "Chrome";
            }
        }
        return browserType;
    }

No comments:

Post a Comment