当前位置: 首页>>代码示例>>Java>>正文


Java WebSettings.setJavaScriptCanOpenWindowsAutomatically方法代码示例

本文整理汇总了Java中com.tencent.smtt.sdk.WebSettings.setJavaScriptCanOpenWindowsAutomatically方法的典型用法代码示例。如果您正苦于以下问题:Java WebSettings.setJavaScriptCanOpenWindowsAutomatically方法的具体用法?Java WebSettings.setJavaScriptCanOpenWindowsAutomatically怎么用?Java WebSettings.setJavaScriptCanOpenWindowsAutomatically使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.tencent.smtt.sdk.WebSettings的用法示例。


在下文中一共展示了WebSettings.setJavaScriptCanOpenWindowsAutomatically方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initWebViewSettings

import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
private void initWebViewSettings() {
    WebSettings ws = mWebView.getSettings();
    ws.setDefaultTextEncodingName("utf-8");
    ws.setJavaScriptEnabled(true);
    ws.setPluginsEnabled(true);
    ws.setDomStorageEnabled(true);
    ws.setRenderPriority(com.tencent.smtt.sdk.WebSettings.RenderPriority.HIGH);
    ws.setAllowFileAccess(true);
    ws.setAllowContentAccess(true);
    ws.setAppCacheEnabled(false);
    ws.setCacheMode(com.tencent.smtt.sdk.WebSettings.LOAD_NO_CACHE);
    ws.setSaveFormData(true);
    ws.setJavaScriptCanOpenWindowsAutomatically(true);
    ws.setLoadsImagesAutomatically(true);
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        ws.setAllowFileAccessFromFileURLs(true);
        ws.setAllowUniversalAccessFromFileURLs(true);
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        mWebView.setWebContentsDebuggingEnabled(true);
    }
}
 
开发者ID:snailycy,项目名称:AndroidHybridLib,代码行数:23,代码来源:WrapperWebView.java

示例2: initWebViewSettings

import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
private void initWebViewSettings() {
    WebSettings webSetting = this.getSettings();
    webSetting.setJavaScriptEnabled(true);
    webSetting.setJavaScriptCanOpenWindowsAutomatically(true);
    webSetting.setAllowFileAccess(true);
    webSetting.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
    webSetting.setSupportZoom(true);
    webSetting.setBuiltInZoomControls(true);
    webSetting.setUseWideViewPort(true);
    webSetting.setSupportMultipleWindows(true);
    // webSetting.setLoadWithOverviewMode(true);
    webSetting.setAppCacheEnabled(true);
    // webSetting.setDatabaseEnabled(true);
    webSetting.setDomStorageEnabled(true);
    webSetting.setGeolocationEnabled(true);
    webSetting.setAppCacheMaxSize(Long.MAX_VALUE);
    // webSetting.setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);
    webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
    // webSetting.setRenderPriority(WebSettings.RenderPriority.HIGH);
    webSetting.setCacheMode(WebSettings.LOAD_NO_CACHE);
}
 
开发者ID:jianesrq0724,项目名称:UpdateLibrary,代码行数:22,代码来源:X5WebView.java

示例3: initWebViewSettings

import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
private void initWebViewSettings() {
    WebSettings webSetting = this.getSettings();
    webSetting.setJavaScriptEnabled(true);
    webSetting.setJavaScriptCanOpenWindowsAutomatically(true);
    webSetting.setAllowFileAccess(true);
    webSetting.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
    webSetting.setSupportZoom(true);
    webSetting.setBuiltInZoomControls(true);
    webSetting.setUseWideViewPort(true);
    webSetting.setSupportMultipleWindows(true);
    webSetting.setAppCacheEnabled(true);
    webSetting.setDomStorageEnabled(true);
    webSetting.setGeolocationEnabled(true);
    webSetting.setAppCacheMaxSize(Long.MAX_VALUE);
    webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
    webSetting.setCacheMode(WebSettings.LOAD_NO_CACHE);
}
 
开发者ID:banwenmang,项目名称:X5web,代码行数:18,代码来源:X5WebView.java

示例4: getWebviewAdaption

import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
public void getWebviewAdaption(WebView webView)
{
       WebSettings webSettings = webView.getSettings();
       webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
       webSettings.setUseWideViewPort(true);//关键点
	//启用地理定位
	webSettings.setDomStorageEnabled(true);
	webSettings.setDatabaseEnabled((Boolean) SPUtils.get(context, "if_4", true));//数据库
	webSettings.setGeolocationEnabled((Boolean) SPUtils.get(context, "if_2", true));//地理
	webSettings.setUserAgentString("" + SPUtils.get(context, "if_7", "Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en-us) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3 XiaoMi/MiuiBrowser/8.9.4"));//UA
       webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
	webSettings.setDisplayZoomControls(false);
	webSettings.setLoadsImagesAutomatically((Boolean) SPUtils.get(context, "if_5", true));//图片
       webSettings.setJavaScriptEnabled((Boolean) SPUtils.get(context, "if_1", true)); // 设置支持javascript脚本
       webSettings.setAllowFileAccess(true); // 允许访问文件
       webSettings.setBuiltInZoomControls(true); // 设置显示缩放按钮
       webSettings.setSupportZoom((Boolean) SPUtils.get(context, "if_3", false)); // 支持缩放
       webSettings.setLoadWithOverviewMode(true);

       DisplayMetrics metrics = new DisplayMetrics();
       //getWindowManager().getDefaultDisplay().getMetrics(metrics);
       int mDensity = metrics.densityDpi;
	// Log.d("maomao", "densityDpi = " + mDensity);
       if (mDensity == 240)
	{
           webSettings.setDefaultZoom(WebSettings.ZoomDensity.FAR);
       }
	else if (mDensity == 160)
	{
           webSettings.setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
       }
	else if (mDensity == 120)
	{
           webSettings.setDefaultZoom(WebSettings.ZoomDensity.CLOSE);
       }
	else if (mDensity == DisplayMetrics.DENSITY_XHIGH)
	{
           webSettings.setDefaultZoom(WebSettings.ZoomDensity.FAR);
       }
	else if (mDensity == DisplayMetrics.DENSITY_TV)
	{
           webSettings.setDefaultZoom(WebSettings.ZoomDensity.FAR);
       }
	else
	{
           webSettings.setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
       }


       webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);


   }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:54,代码来源:x5_WebviewSelfAdaption.java

示例5: initData

import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
private void initData() {
        //启用支持javascript
        WebSettings settings = mWebView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setJavaScriptCanOpenWindowsAutomatically(true);
        settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
        settings.setDomStorageEnabled(true);
        settings.setAllowFileAccess(true);
        settings.setLoadWithOverviewMode(true);
//        settings.setTextSize(WebSettings.TextSize.LARGEST);//设置字体大小
        settings.setTextZoom(100);//设置字体大小
        settings.setDefaultTextEncodingName("utf-8");//设置默认编码格式
//        //自适应屏幕
        settings.setUseWideViewPort(true);

        if (mBody != null) {
            try {
                //由于body的数据进行了URLEncode编码,所以需要我们再进行URLDecoder解码
                //否则只能显示图片
                mDecode = URLDecoder.decode(mBody, "utf-8");
                //发布时间
                mDate = DateUtils.dateFromat(mSenddate);
                //自定义样式,设置图片显示大小
                mHtml = "<html><body>"
                        + "<h3>"
                        + mTitle
                        + "</h3>"
                        + "<p>"
                        + "作者:" + mWriter
                        + "&nbsp&nbsp"
                        + "发布时间:" + mDate
                        + "&nbsp&nbsp"
                        + "来源:" + mSource
                        + "</p>"
                        + "<style>"
                        + "img{width:100%;height:auto;}"//自定义样式,设置图片显示大小
                        + "</style>"
                        + mDecode
                        + "</body></html>";

                mWebView.loadDataWithBaseURL(DMGEAME_URL, mHtml, "text/html", "charset=UTF-8", null);
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
            Log.e("接收数据", mBody);

        }
    }
 
开发者ID:v991314,项目名称:3DGameInfo,代码行数:49,代码来源:ChapterDetailActivity.java


注:本文中的com.tencent.smtt.sdk.WebSettings.setJavaScriptCanOpenWindowsAutomatically方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。