javascript xcode readability
javascript xcode readability
我正在尝试使用与Safari相同的系统来转换具有可读性bookmarklet的页面。
我尝试了以下方法:
NSString *searchURL = @"javascript:(%28function%28%29%7Bwindow.baseUrl%3D%27https%3A//www.readability.com%27%3Bwindow.readabilityToken%3D%27%27%3Bvar%20s%3Ddocument.createElement%28%27script%27%29%3Bs.setAttribute%28%27type%27%2C%27text/javascript%27%29%3Bs.setAttribute%28%27charset%27%2C%27UTF-8%27%29%3Bs.setAttribute%28%27src%27%2CbaseUrl%2B%27/bookmarklet/read.js%27%29%3Bdocument.documentElement.appendChild%28s%29%3B%7D%29%28%29)";
NSURL *url = [NSURL URLWithString:[searchURL stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];
NSLog(@"launched readability");
// NSURL *url = [NSURL URLWithString:searchURL];
[webBrowser loadRequest:[NSURLRequest requestWithURL:url]];
但那没用。。
我还尝试了以下内容:
[webBrowser stringByEvaluatingJavaScriptFromString:@"function%28%29%7Bwindow.baseUrl%3D%27https%3A//www.readability.com%27%3Bwindow.readabilityToken%3D%27%27%3Bvar%20s%3Ddocument.createElement%28%27script%27%29%3Bs.setAttribute%28%27type%27%2C%27text/javascript%27%29%3Bs.setAttribute%28%27charset%27%2C%27UTF-8%27%29%3Bs.setAttribute%28%27src%27%2CbaseUrl%2B%27/bookmarklet/read.js%27%29%3Bdocument.documentElement.appendChild%28s%29%3B%7D%29%28%29"];
但这也没有奏效。有人能给我指正确的方向吗?
指向可读性bookmarklet网站的链接:https://www.readability.com/bookmarklets
您需要对JavaScript进行unescape(即,通过JavaScript的unescape函数运行它)。因此,使用:(function(){window.baseUrl='https://www.readability.com';window.readabilityToken='';var s=document.createElement('script');s.setAttribute('type','text/javascript');s.setAttribute('charset','UTF-8');s.setAttribute('src',baseUrl+'/bookmarklet/read.js');document.documentElement.appendChild(s);})()
相关文章:
- 使用jqplot和html css和js在ios xcode上创建饼图的问题
- Xcode-UIWebview不显示CSS、Javascript或外部内容
- 如何在Xcode 4.3上使用JavaScript
- JavaScript-添加图像:React Native XCode
- Xcode,乘坐未知序列
- 使用xcode模拟器的本地react具有非常慢的警报
- Javascript array to NSArray in Xcode
- Xcode Instruments - UIAButton Class - Method .isEnabled() 不起
- Phonegap - 在 xcode 中配置调试和发布版本
- UIAutomation in Xcode
- HTML5/Javascript 输入只读状态在 IOS 上使用 XCode 滑动
- 从 JavaScript 函数返回数组到 Objective-C Xcode
- Xcode 从 WebView 解析 HTML ID 数据
- Xcode:uiwebview加载其内容时的分配和泄漏
- Phonegap AdMob 插件在 Xcode 中获取横幅高度
- 音频元素在Safari中运行良好,但在XCode模拟器(web视图)中中断
- 带有XCode的正则表达式Javascript
- alert() 和 Notification.alert() 在 Xcode 中使用 PhoneGap 之间有区别吗?
- Instruments Xcode中的UIAutomation测试模块
- javascript xcode readability