xcode - WebView not run JS -


i trying run js script on webview. script return's 2 script (1 lib + 1 image creator). when run on browser runs perfect. when run on mobile (webview) cant see anything.

nsstring * script = [nsstring stringwithformat:@"<body><body><script data-server=\"adman|http://adman.gr/\">(function() {document.write('<sc'+'ript data-ws=\"1015\" data-h=\"sport-fm.adman.gr\" data-s=\"320x50\" data-iframe=\"false\" data-kw=\"\" data-p=\"\" src=\"http://static.adman.gr/adman.js\"></sc'+'ript>');}());</script></body></body>"];  [_webview loadhtmlstring:script baseurl:nil];  [ _webview stringbyevaluatingjavascriptfromstring: @"function()" ]; 

ah, met issue before.

here solution:

enter image description here

put script js file. load script,

static nsstring *jshandler; jshandler = [nsstring stringwithcontentsofurl:[[nsbundle mainbundle] urlforresource:@"script" withextension:@"js"] encoding:nsutf8stringencoding error:nil]; [self.webview stringbyevaluatingjavascriptfromstring:jshandler]; 

done!


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -