objective c - javascript inject in uiwebview of iOS 8 -
i testing project in ios 8 preview 2. , faces 2 problems uiwebview
use following code inject script
nsstring *jsclose_window = @"function close_window(){ document.location ='myschema://function=close_window'; }"; [self.webview stringbyevaluatingjavascriptfromstring:jsclose_window];
in "-(void)webviewdidfinishload:(uiwebview *)webview"
, response in
- (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype
it works fine in ios 7.1 , earlier. in ios 8 preview 2
1.document.location = 'myschema://function=close_window';
seems not working anymore? can't response in "shouldstartloadwithrequest" 2.in ios 7.1 , earlier every time page redirect another
(ex:page1.html -> page2.html -> page3.html)
"webviewdidfinishload" triggered in every page.
but, in ios 8 preview 2 triggered once in first page
how fix these?, or new limitations in ios 8? ideas? appreciate.
after lot of search. finally, got solution, follow link link here. problem javascript. rewrite javascript sample style , works fine in ios 8(tested in beta3) right now.
Comments
Post a Comment