webview

Android客户端注入及清除Cookie

风流意气都作罢 提交于 2020-03-02 08:39:19
在Android应用程序中经常会加载一个WebView页,如果需要客户端向WebView传递信息,比如Cookie,也是可以的。 需要应用程序先将Cookie注入进去,打开该网页时,WebView会将加载的url通过http请求传输到服务器。同时,在这次请求中,会将Cookie信息通过http header传递过去。 流程如下: 1、客户端通过以下代码设置cookie public static void synCookies(Context context, String url) { CookieSyncManager.createInstance(context); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setCookie(url, "uid=1243432"); CookieSyncManager.getInstance().sync(); } 2、CookieManager会将这个Cookie存入该应用程序/data/data/databases/目录下的webviewCookiesChromium.db数据库的cookies表中 3、打开网页,WebView从数据库中读取该cookie值,放到http请求的头部,传递到服务器 4

SL4A、QPython学习笔记

我是研究僧i 提交于 2020-03-02 06:44:20
耐着性子钻研了一下sl4a与QPython之类,取得了些经验,汇报如下: 本文使用的apk安装包如下: QPython: QPython70.apk;sl4a+Python:sl4a_r6.apk;PythonForAndroid_r4.apk。 安装与使用方法十分简单,网上参考很多,本文不再重复安装方法与HelloWorld之类。 I. sl4a+Python 1. 重要参考资料: (1) Pro Android Python with SL4A(PDF) (2) SL4A API HELP ;(3) 如何使用Webview: Webviews with SL4A: A Call and Two Hooks 2. 以下一例,演示如何通过sl4a api取得Gps与罗盘信息,相关技术资料详见详见参考资料(2)中LocationFacade;SensorManagerFacade章节 # -*- coding: utf-8 -*- import android import time from math import radians droid = android.Android() droid.startSensingTimed(1, 250) droid.startLocating() while 1: gpsdata = droid.readLocation().result

WKWebview的基本使用

て烟熏妆下的殇ゞ 提交于 2020-03-01 03:25:55
在开发过程中,iOS 中实现加载 web 页面主要有两种控件,UIWebView 和 WKWebview,两种控件对应具体的实现方法不同。WKWebView是苹果公司在iOS8系统推出的,这里主要概述WebKit中更新的WKWebView控件的新特性与使用方法,以及小编在开发过程中踩的坑。 一、相比于UIWebView的优势: 在性能、稳定性、占用内存方面有很大提升; 允许JavaScript的Nitro库加载并使用(UIWebView中限制) 增加加载进度属性:estimatedProgress,不用在自己写假进度条了 支持了更多的HTML的属性 二、WKWebview的常用属性 @property (nullable, nonatomic, readonly, copy) NSString *title; @property (nullable, nonatomic, readonly, copy) NSURL *URL; @property (nonatomic, readonly, getter=isLoading) BOOL loading; //加载进度 @property (nonatomic, readonly) double estimatedProgress; 三、WKWebview的常用方法 - (nullable WKNavigation *

iOS中UIWebView使用JS交互

喜夏-厌秋 提交于 2020-02-29 11:23:57
iOS中偶尔也会用到webview来显示一些内容,比如新闻,或者一段介绍。但是用的不多,现在来教大家怎么使用js跟webview进行交互。 这里就拿点击图片获取图片路径为例: 1.测试页面html <!doctype html><html> <head> </head> <body> <div> <img src="test.png"/> </div> </body></html> 2.然后我们在controller中加载这一段html [_webview loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle]URLForResource:@"work" withExtension:@"html"]]]; 3.可以看到,这里只显示一张图片 4.加载相关js文件,命名为test.js function setImageClickFunction() { var imgs = document.getElementsByTagName("img"); for (var i=0;i<imgs.length;i++) { var src = imgs[i].src; imgs[i].setAttribute("onClick","click(src)"); } document.location = imageurls

WebView当前APP加载网页内容

江枫思渺然 提交于 2020-02-29 03:56:56
1、 l oadUrl(String url);直接加载网页、图片并显示 本地资源: mWebview.loadUrl ("file:///android_asset/x.html"); 远程资源: mWebview.loadUrl (“http://www.baidu.com"); 2、 loadData ( data, mimeType , encoding ): data: 要加载的网页内容。不能是网址。   mimetype : 加载的网页内容的类型 (text/ html,image /jpeg)   encoding :指定编码 utf-8 或者 gbk   事实证明这个经常会出现中文乱码。   //API 提供的标准用法,无法解决乱码问题   webView.loadData (data, “text/html”, “UTF -8”);   修改为:   // 这种写法可以正确解码   webView.loadData (data, "text/html; charset =UTF-8", null);   loadData 不支持 # 、 % 、 \ 、 ? 四种字符。但也不是完全不支持,表现很怪异。 3、loadDataWithBaseURL ( baseUrl , data, mimeType , encoding, failUrl ): 参数说明:

webview_flutter “Failed to validate the certificate chain” SSL handshake failed error

核能气质少年 提交于 2020-02-29 00:02:40
问题 I had this problem and solved it with the help of this but it took me some time to figure out where to put the code since the codes are a bit different between flutter_webview_pugin vs webview_flutter . so this a tutorial to show how to implement this method for webview_flutter on MacOS(on windows only file may differ) 1- copy this folder /Volumes/.../Flutter/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.10+4 to one step up from the root of your project somewhere like for

webview_flutter “Failed to validate the certificate chain” SSL handshake failed error

霸气de小男生 提交于 2020-02-29 00:01:30
问题 I had this problem and solved it with the help of this but it took me some time to figure out where to put the code since the codes are a bit different between flutter_webview_pugin vs webview_flutter . so this a tutorial to show how to implement this method for webview_flutter on MacOS(on windows only file may differ) 1- copy this folder /Volumes/.../Flutter/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.10+4 to one step up from the root of your project somewhere like for

GUI之JavaFX

僤鯓⒐⒋嵵緔 提交于 2020-02-28 17:39:22
  一、JavaFX不深究系列,目的只是为了尝试使用GUI的方式来生成桌面应用。   二、JavaFX是一个强大的图形和多媒体处理工具包集合,它允许开发者来设计、创建、测试、调试和部署富客户端程序,并且和Java一样跨平台。说白了就是利用Java的跨平台关系,做了一个图形处理工具。   三、详细学习可以参考: http://www.javafxchina.net/main/ 东西很多,不建议深究。   四、来点基本案例:   1)HelloWorld import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class HelloWorld extends Application{ public void start(Stage primaryStage) throws Exception { //按钮绑定事件 Button button = new Button(); button.setText("hello world"); button.setOnAction(event ->

(最新)移动App应用安全漏洞分析报告 !

淺唱寂寞╮ 提交于 2020-02-28 15:58:39
  漏洞扫描方式主要分为静态和动态,静态扫描的漏洞类型主要包含SQL注入风险、webview系列、文件模式配置错误、https不校验证书、database配置错误等。动态扫描的漏洞类型主要包含拒绝服务攻击、文件目录遍历漏洞、file跨域访问等。   本报告选取11类android app中同等数量的热门app,其活跃用户量可覆盖83%的移动端网民,根据阿里巴巴移动安全中心对这些app的漏洞检测,得到以下结论:   参与检测的android app中,近97%的app都存在漏洞问题,且平均漏洞量高达40个。   安全类app漏洞问题最多,其漏洞总量499个,占所有类别app漏洞总量的21%。   新闻、旅游类app相对最不安全,其各自漏洞总量约240个,且其中高危漏洞量占比30%。   游戏类app相对最安全,漏洞总量约57个,且其中高危漏洞占比约2%。   从测试结果来看,android app的安全问题不容乐观,漏洞的存在尤其是高危漏洞,会对app开发者甚至用户带来较大影响,如何提前发现潜在风险、保护开发者和用户的利益是阿里巴巴移动安全团队一直坚持的责任。   第一章 Android APP漏洞现状   为了解android app的总体现状,报告中将app归纳为11个类别:健康、娱乐、安全、教育、新闻、旅游、游戏、社交、购物、金融、阅读。选取11类app中等量热门app

[Android]记录一下整理的使用pdfjs本地查看pdf的方法

ぐ巨炮叔叔 提交于 2020-02-28 12:55:15
感谢: https://blog.csdn.net/j236027367/article/details/78851248 上面的那篇博客已经详细地介绍了如何完整地加入这个功能,甚至还加入了双指缩放!就很厉害。 下面我记录的将会是我以后直接使用的方法: ①创建一个assets的文件夹,并将pdfjs解压到该文件夹下; 链接:https://pan.baidu.com/s/14qyy6uQIga64uvzmOUptyQ 提取码:tzq0 ②加入一个webview, 并对webview做好配置。 private void initView() { WebSettings settings = webView.getSettings(); settings.setSavePassword(false); settings.setJavaScriptEnabled(true); settings.setAllowFileAccessFromFileURLs(true); settings.setAllowUniversalAccessFromFileURLs(true); settings.setBuiltInZoomControls(true); webView.setWebViewClient(new WebViewClient() { @Override public boolean