Expose the JSGlobalContextRef of a UIWebView's top-level frame
| Originator: | nathan | ||
| Number: | rdar://11261944 | Date Originated: | 17-Apr-2012 04:57 PM |
| Status: | Open | Resolved: | No |
| Product: | Safari | Product Version: | 7534.48.3 |
| Classification: | Enhancement | Reproducible: | Yes |
17-Apr-2012 04:57 PM Nathan de Vries: Summary: The public WebKit.framework that ships on Mac OS X allows you to access the JavaScriptCore context of a WebView's top-level frame like so: WebView* webView = ...; WebFrame* webFrame = [webView mainFrame]; JSGlobalContextRef globalContextRef = [webFrame globalContext]; Once you have access to the globalContext, writing bindings between your native application wrapper and the web content is trivial. On iOS, these APIs are private. The only way to write a bridge between native and web content with UIWebViews is to use stringByEvaluatingJavaScriptFromString: and custom URL handlers, both of which are limited to string-based protocols. This is error prone, slow, and cumbersome. Making these APIs private does not prevent data being passed back & forth, it simply creates more work for the developer. Expected Results: Accessing the JSGlobalContextRef of a UIWebView's top-level frame should be supported with a public API. Actual Results: The API is private. Regression: N/A Notes: N/A
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!