webview js 注入
来源:互联网 发布:淘宝怎么看行情数据 编辑:程序博客网 时间:2024/05/16 09:22
- (void)addSetPayPwdListener:(UIWebView *)webView{
NSArray *valueArray = [valueDictionary objectForKey:@"setPayPwd"];
NSString *pwdId1 = valueArray[0];
NSString *pwdId2 = valueArray[1];
NSString *submitButtonId = valueArray[2];
NSMutableString *setPayPwdJsHtml = [NSMutableString new];
[setPayPwdJsHtml appendString:@"var btn = document.getElementById('"];
[setPayPwdJsHtml appendString:submitButtonId];
[setPayPwdJsHtml appendString:@"');"];
[setPayPwdJsHtml appendString:@" btn.onmousemove = function showMessage() {"];
[setPayPwdJsHtml appendString:@" transformParam("];
[setPayPwdJsHtml appendFormat:@"document.getElementById('%@').value,",pwdId1];
[setPayPwdJsHtml appendFormat:@"document.getElementById('%@').value)",pwdId2];
[setPayPwdJsHtml appendString:@" };"];
DLog(@"%@",setPayPwdJsHtml);
JSContext *context=[webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
//js调用OC
context[@"transformParam"] = ^(){
NSArray *args = [JSContext currentArguments];
if (args.count == 2) {
JSValue *firstValue = [args objectAtIndex:0];
JSValue *secondValue = [args objectAtIndex:1];
if ([firstValue.toString isEqualToString:secondValue.toString]) {
[self sendPayPassword:[firstValue toString]];
}
}
};
[context evaluateScript:setPayPwdJsHtml];
}
NSArray *valueArray = [valueDictionary objectForKey:@"setPayPwd"];
NSString *pwdId1 = valueArray[0];
NSString *pwdId2 = valueArray[1];
NSString *submitButtonId = valueArray[2];
NSMutableString *setPayPwdJsHtml = [NSMutableString new];
[setPayPwdJsHtml appendString:@"var btn = document.getElementById('"];
[setPayPwdJsHtml appendString:submitButtonId];
[setPayPwdJsHtml appendString:@"');"];
[setPayPwdJsHtml appendString:@" btn.onmousemove = function showMessage() {"];
[setPayPwdJsHtml appendString:@" transformParam("];
[setPayPwdJsHtml appendFormat:@"document.getElementById('%@').value,",pwdId1];
[setPayPwdJsHtml appendFormat:@"document.getElementById('%@').value)",pwdId2];
[setPayPwdJsHtml appendString:@" };"];
DLog(@"%@",setPayPwdJsHtml);
JSContext *context=[webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
//js调用OC
context[@"transformParam"] = ^(){
NSArray *args = [JSContext currentArguments];
if (args.count == 2) {
JSValue *firstValue = [args objectAtIndex:0];
JSValue *secondValue = [args objectAtIndex:1];
if ([firstValue.toString isEqualToString:secondValue.toString]) {
[self sendPayPassword:[firstValue toString]];
}
}
};
[context evaluateScript:setPayPwdJsHtml];
}
阅读全文
0 0
- WebView Js注入
- JS注入webview
- webview注入js方法
- Android webview 注入JS
- webview js 注入
- Webview动态注入js脚本
- Webview动态注入js脚本
- Android WebView JS的注入
- Android中向webview注入js代码
- 【Android实测】WebView的JS注入
- Android Webview js或css 替换 注入
- Android在WebView中注入Js代码
- iOS webView中调用JS与JS注入
- Android WebView的Js对象注入漏洞解决方案
- Android WebView的Js对象注入漏洞解决方案
- Android WebView的Js对象注入漏洞解决方案
- Android WebView的Js对象注入漏洞解决方案
- Android WebView的Js对象注入漏洞解决方案
- thymleaf #lists #dates 用法
- hibernate主要的ID生成策略
- android系统权限总结与分析
- XML和JSON区别
- iOS开发 UIImageView的分类
- webview js 注入
- Qt Arducopter ArduPilot编译环境搭建
- js简单放大镜
- MySQL中采用类型varchar(20)和varchar(255)对性能上的影响
- 网页前端CSS之选择器
- 第一个android项目开发日志(1)
- 用Qt Creator编译opencv并配置开发环境
- [Android Exercise]仿微信游戏界面PART.1—ConstraintLayout和RecyclerView的应用
- 使用mmenu制作侧边抽屉菜单