我有一个WKWebView,它加载了一个名为'start.html'的本地html文件.在此文件中,我在iframe中加载了其他本地文档.
但我不允许在iframe内容上使用来自start.html的js,并且不允许iframe内容加载js文件.
在WKWebView之前我使用UIWebView但我不得不迁移以提高性能
在UIWebView中,我从未遇到过跨域安全性的任何问题.
当我sandbox='allow-same-origin'在iframe上添加属性时,我可以像这样从start.html成功执行js代码
$("#frame")[0].contentWindow.document.getElementsByClassName('password_field')[0].value = password_field
Run Code Online (Sandbox Code Playgroud)
但是ifs内部的js代码和http请求(在iframe中加载的文件是一个js播放器)是不允许运行的,我得到了这些错误:
Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match.
Run Code Online (Sandbox Code Playgroud)
UIWebVIew和WKWebView有什么区别.是否有解决方案允许在iframe中使用js代码和http请求?
我使用performSegueWithIdentifier在视图控制器之间导航
我有一个包含多行的tableView,当一行被操作时,我调用webViewController来播放选定的ressource与segue
performSegueWithIdentifier("Play", sender: nil)
Run Code Online (Sandbox Code Playgroud)
关联:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if(segue.identifier == "Play") {
let detailVC = segue.destinationViewController as! WebViewController
detailVC.courseToPlay = self.courseToPlay
}
}
Run Code Online (Sandbox Code Playgroud)
而且,在WebViewController上,我在列表上有一个goBack按钮,我想在goBack上销毁webViewController的实例
我的storyBoard中没有NavigationController,所以,这行不起作用
navigationController.popViewControllerAnimated(true)
Run Code Online (Sandbox Code Playgroud)
我再次使用segue goBack:
performSegueWithIdentifier("closePlayer", sender: nil)
Run Code Online (Sandbox Code Playgroud)
但每个segue动作实例都是一个新的视图控制器,它们从来没有真正从记忆中解脱出来,它们似乎只是隐藏起来
例如:在Safari调试器中,我可以看到很多页面,我总是可以在控制台中与这些页面进行交互
如何在场景变化时正确"破坏"视图
使用WKWebview播放本地文件在模拟器上工作,但在设备上给我这个错误(iOS 9.2.1)
fail in didFailProvisionalNavigation Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"
UserInfo={NSErrorFailingURLKey=file:///var/mobile/Containers/Data/Application/2FBE4DE6-9441-4C5A-BB1F-8598CA89664C/Documents/courses/agdg_test1455704820291/index.html?jqueryFilePath=file:///var/mobile/Containers/Bundle/Application/5A442D34-3360-46C7-8B28-B6F3AED373CE/elearning.app/view/jquery.js&commandsFilePath=file:///var/mobile/Containers/Bundle/Application/5A442D34-3360-46C7-8B28-B6F3AED373CE/elearning.app/view/commands.js,
_WKRecoveryAttempterErrorKey=<WKReloadFrameErrorRecoveryAttempter: 0x15e295f0>,NSErrorFailingURLStringKey=file:///var/mobile/Containers/Data/Application/2FBE4DE6-9441-4C5A-BB1F-8598CA89664C/Documents/courses/agdg_test1455704820291/index.html?jqueryFilePath=file:///var/mobile/Containers/Bundle/Application/5A442D34-3360-46C7-8B28-B6F3AED373CE/elearning.app/view/jquery.js&commandsFilePath=file:///var/mobile/Containers/Bundle/Application/5A442D34-3360-46C7-8B28-B6F3AED373CE/elearning.app/view/commands.js}
Run Code Online (Sandbox Code Playgroud)
这是配置webView的代码:
let lesson:NSMutableArray = courseDB_Manager.getInstance().getRowDB("SELECT * FROM lesson_chapter WHERE lesson_chapter_id = ?", args: [chapterToPlay], structType: "lesson_chapter")
let occ: lesson_chapter_struct = lesson[0] as! lesson_chapter_struct
fileToPlay = Utility.getPath("courses/" + occ.lesson_chapter_fichier)
let commandsFilePath = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("commands", ofType: "js", inDirectory: "view")!, isDirectory: false)
let jqueryFilePath = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("jquery", ofType: "js", inDirectory: "view")!, isDirectory: false)
let target = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("start", ofType: "html", inDirectory: "view")!, isDirectory: false)
let params = "?fileToPlay=" + …Run Code Online (Sandbox Code Playgroud) 我使用适用于 iOS 11 的 PDFKit,使用搜索功能,我得到了一些PDFSelection元素。如何在 PDF 中突出显示与此选择相对应的文本?
我试过这个,但没有用:
selection.color = UIColor.red
selection.draw(for: selection.pages.first!, active: true)
Run Code Online (Sandbox Code Playgroud) 我在github PThread项目页面上看到支持php7 +.
我在ubuntu发行版上有php7.1.6(16.04)
我找不到任何提供php7.1-zts的PPA.
如何在php7.1上启用zts来安装pthreads?
ios ×3
swift ×2
cross-domain ×1
javascript ×1
objective-c ×1
php ×1
php-7.1 ×1
pthreads ×1
segue ×1
swift2 ×1
ubuntu-16.04 ×1
uiwebview ×1
wkwebview ×1
zts ×1