The ads which am integrating is from adbutler. The code for the ad is in javascript. i need to run the js code in UIWebview. Any suggestions.
The sample code is :
<script type="text/javascript">
var rnd = window.rnd || Math.floor(Math.random()*10e6);
var pid156452 = window.pid156452 || rnd;
var plc156452 = window.plc156452 || 0;
var abkw = window.abkw || '';
var absrc = 'http://ab152067.adbutler-photon.com/adserve/;ID=152067;size=320x100;setID="some number";type=iframe;kw='+abkw+';pid='+pid156452+';place='+(plc156452++)+';rnd='+rnd+'';
document.write('<ifr'+'ame src="'+absrc+'" width="320" height="100" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></ifr'+'ame>');
</script>
make the code you want to run a function() in the web page.
From iOS WebView call stringByEvaluatingJavaScriptFromString: the function
JavaScript function:
function adCrapFunction()
{
alert('Hey there buy something.');
}
iOS:
[self.webview stringByEvaluatingJavaScriptFromString:@"adCrapFunction();"];
Some things that will get you:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.