Package org.eclipse.swt.browser

Examples of org.eclipse.swt.browser.Browser.evaluate()


    shell.setLayout(new FillLayout());
    Browser browser_ = new Browser(shell, browser.getStyle());
    browser_.setText("<html></html>");
    String browserName = null;
    String versionSearch = null;
    String userAgent = (String)browser_.evaluate("return navigator.userAgent");
    String navigatorVendor = (String)browser_.evaluate("return navigator.vendor");
    if(browserName == null && userAgent != null && userAgent.indexOf("Chrome") != -1) {
      versionSearch = browserName = "Chrome";
    }
    if(browserName == null && userAgent != null && userAgent.indexOf("OmniWeb") != -1) {
View Full Code Here


    Browser browser_ = new Browser(shell, browser.getStyle());
    browser_.setText("<html></html>");
    String browserName = null;
    String versionSearch = null;
    String userAgent = (String)browser_.evaluate("return navigator.userAgent");
    String navigatorVendor = (String)browser_.evaluate("return navigator.vendor");
    if(browserName == null && userAgent != null && userAgent.indexOf("Chrome") != -1) {
      versionSearch = browserName = "Chrome";
    }
    if(browserName == null && userAgent != null && userAgent.indexOf("OmniWeb") != -1) {
      browserName = "OmniWeb";
View Full Code Here

    if(browserName == null && navigatorVendor != null && navigatorVendor.indexOf("Apple") != -1) {
      browserName = "Safari";
      // "Version" is probably more user friendly but is not always accessible.
      versionSearch = "AppleWebKit";
    }
    if(browserName == null && (String)browser_.evaluate("return window.opera") != null) {
      versionSearch = browserName = "Opera";
    }
    if(browserName == null && navigatorVendor != null && navigatorVendor.indexOf("iCab") != -1) {
      versionSearch = browserName = "iCab";
    }
View Full Code Here

        if(index >= 0) {
          browserVersion = userAgent.substring(index + versionSearch.length() + 1);
        }
      }
      if(browserVersion == null) {
        String appVersion = (String)browser_.evaluate("return navigator.appVersion");
        if(appVersion != null) {
          int index = appVersion.indexOf(versionSearch);
          if(index >= 0) {
            browserVersion = appVersion.substring(index + versionSearch.length() + 1);
          }
View Full Code Here

  private static class CMN_executeJavascriptWithResult extends ControlCommandMessage {
    @Override
    public Object run(Object[] args) {
      String script = (String)args[0];
      Browser browser = (Browser)getControl();
      return browser.evaluate(fixJavascript(browser, script));
    }
  }

  public Object executeJavascriptWithResult(String script) {
    return runSync(new CMN_executeJavascriptWithResult(), script);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.