WKUserScript forMainFrameOnly

眉间皱痕 提交于 2019-12-13 03:31:56

问题


WKUserScript has this init

init(source: String, injectionTime: WKUserScriptInjectionTime, forMainFrameOnly: Bool)

Simply what is meant by 'MainFrame' ?


回答1:


WebView is the core view class in the WebKit framework that manages interactions between the WebFrame and WebFrameView classes.WebFrame objects encapsulate the content contained in a single frame element.

A hierarchy of WebFrame objects is used to model an entire webpage where the root is called the main frame.

There is a WebFrameView object per WebFrame object used to display the frame content. Therefore, there is a parallel hierarchy of WebFrameView objects used to render an entire page. The WebView object is also the parent view of this hierarchy. You do not need to create WebFrame and WebFrameView objects directly. These objects are automatically created when the page loads, either programmatically or by the user clicking a link.

Note

In apps that run in OS X 10.10 and later, use the WKWebView class instead of using WebView.



来源:https://stackoverflow.com/questions/49850682/wkuserscript-formainframeonly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!