webview

Android原生控件 -- WebView

允我心安 提交于 2020-01-07 11:12:48
⒈用途    加载网页 加载URL(网络或者本地assets文件夹【这个文件夹下存放着我们不需要编译的资源文件,例如html等不需要编译成二进制代码】下的html文件) 加载html代码 Native和JavaScript相互调用(混合调用) ⒉使用    加载网络URL webview.loadUrl("https://www.coreqi.cn");   **默认WebView不支持js(JavaScript),需要开启支持 webview.getSettings().setJavaScriptEnabled(boolean flag);   加载assets文件夹下的html文件 webview.loadUrl("file:///android_asset/test.html");   加载html代码 webview.loadData(); //这个方法有时会出现例如乱码等情况 webview.loadDataWithBaseURL();  //这个方法通常在编码设置方面相较好一些   网页的前进后退 webview.canGoBack() //当前页面是否能够后退 webview.goBack() //返回当前页面的上一个页面 (后退) webview.canGoForward() //当前页面是否能够前进 webview.goForward() /

UIWebView加载本地HTML文件

倾然丶 夕夏残阳落幕 提交于 2020-01-07 09:27:00
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 一.准备HTML文件及其资源文件 使用UIWebView加载本地的HTML文件 index.html,在index.html中引用了本地的图片、CSS文件、JS文件以及外部的图片。 index.html 内容如下 <html> <head> <link href="index.css" rel="stylesheet" type="text/css"> <script type="text/javascript"language="javascript"src="index.js"> </head> <body> <p>This is local Image</p> <img src="Smiley.png" width="50" height="50" /> <hr/> <p>this is local image from CSS.</p> <div id="myimage"> </div> <hr/> <p>this is external image.</p> <img src="http://imglf9.ph.126.net/F37NyhuzmvHJChMARbFmHA==/1010495166409149719.jpg" width="300" height="200" /> </body> <

探索小程序实现

為{幸葍}努か 提交于 2020-01-07 08:15:52
随着小程序的发展与功能的逐步完善,越来越多的产品需要小程序与 APP 的功能能有一些共性,社区跨平台的解决方案越来越多,比如 taro 等为代表的把一套代码编译成多端运行的机制,本文会使用 Swift 作为原生语言,在 iOS 应用上运行一个小程序 Demo, 使用 Android && React Native 也可以采用同样的思路实现。 相关代码仓库: https://github.com/taixw2/rmini 编译层 编译的目的是为了抹平小程序的与 H5 的差异,利用 Vue 实现数据绑定,利用 Web Component 实现小程序的组件功能。 从官网文档中可以看出来,运行一个小程序需要框架(数据绑定渲染)、组件(小程序渲染单元)、api(与原始交互的能力)。 框架实现 转换成单页应用(一种可行的方案) 把所有页面打包成一个 js, 再由 js 管理所有的路由和状态,这种方案适合在 web 端运行,并且是单引擎的方案,在模拟原生的右滑返回等效果也会不尽人意。 转换成多页面 众所周知,小程序是一个双引擎的框架,上面的方案显然不能达到要求, 双引擎的特点是在运行 javascript 的黑盒子中,无法访问到 DOM && BOM 等。将所有的逻辑代码在原生的 JavascriptCore 中运行,WebView 中的 Javascript 引擎负责数据绑定,需要解决的难点是

How to block Load image in UIWebView iOS?

早过忘川 提交于 2020-01-07 06:56:01
问题 I want to use UIWebView to load url, but don't load the image in the webpage.I want UIWebView just display the plain text in the webpage. thanks. 回答1: Your best bet is to set a delegate for the webView and implement the delegate method: webView:shouldStartLoadWithRequest:navigationType: Depending on how the page is constructed, you could get a notification for when the image wants to load, and return NO to stop the webView from loading that resource. Edit: If you didn't set your web view's

Android progressbar on webview appearing twice

Deadly 提交于 2020-01-07 06:17:09
问题 I'm trying to create a simple app for android with progress bar . Everything works fine. But, here two issues 1) When the application is launched i can see progress loading twice. 2) How can i disable the progress bar after the initial page is finished loading. I dont want to show the progressbar on each click.. Here is my code package com.mycom.jquery; import android.app.Activity; import android.app.ProgressDialog; import android.os.Bundle; import android.view.Window; import android.webkit

“loading” message when starting Android app doesn't disappear

╄→гoц情女王★ 提交于 2020-01-07 05:38:06
问题 I would like to show a "loading..." message when my Android . I managed to do this with the code below, but the problem is that it keeps displaying the "Loading..." message, even when the page is already loaded. It disappears when I click on the background, but it's definitely not what I had in mind when using this code. So what I would like to do is showing a loading message for exactly 3 seconds. Can anyone help me out with this one? public void onLoadResource (WebView view, String url) {

How to set phone speaker as default audio output in webview (Ionic)

假装没事ソ 提交于 2020-01-07 05:25:17
问题 I have implemented twilio VOIP in ionic framework. When i trigger call at that time phone speaker will serve as default audio output source instead of phone default speaker. I have try using getUserMedia() but i haven't fount correct way. I want something cool like audio.setSpeaker(phoneSpeaker) 回答1: I have found cordova plugin that toggle speakers. these plugin will found here https://github.com/alongubkin/audiotoggle cordova plugin add audiotoggle 来源: https://stackoverflow.com/questions

WebView removing spaces from text

风流意气都作罢 提交于 2020-01-07 04:35:08
问题 I'm using a WebView to display a formatted HTML text file with color and font size. My problem is it keeps removing spaces form the text, like it will combine two words together. I think it is because it is trying to fit the text within the screen width. How do I fix this? Or is there a better way to display formatted text like this? (I need size, color, links, and some centered text Also, how do I remove the white background underneath the scrollbar? Thanks! 回答1: Does the text file have HTML

Access Webview inside Gridview datatemplate

假如想象 提交于 2020-01-07 03:12:11
问题 I have Webview as one of the control inside Gridview datatemplate. How would i access and bind data to this Webview inside Gridview. I have tried VisualTreeHelper.GetChildren method. But could not succeed. Please help. 回答1: Able to resolve with same VisualTreeHelper.GetChildren method. Previously i was parsing child controls as Control type. Since WebView is a Framework element I did not get WebView control. Now when I try to parse as FramewoekElement, I am able to get it. Still wondering if

Post request in web view windows phone - using C#

孤者浪人 提交于 2020-01-07 03:01:24
问题 I am trying to achieve the same thing, but I am getting exception when I call the InvokeScript method, Please help. I used this link (Post data with a request in a Windows Store app WebView - using C#) to code, Here is my JV webview.NavigateToString(@"<html> <head> <script type='text/javascript'> function doSomething(userIdValue, sessionIdValue) { document.getElementById('Username').value = userIdValue; document.getElementById('Password').value = sessionIdValue; document.getElementById(