I have a little problem when I passing url to javascript
this one is javascript file
function geturl(getdata) {
document.getElementById('test001').src = getdata;//Iframe don't display data.but if I put url like 'http://stackoverflow.com/questions/ask' is will work.
}
window.onload = function ()
{
geturl();
}
and Obj-C
NSString * getdata = @"de";
[subView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"geturl('%@')",[getdata stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]];
NSLog(@" getdata = %@",getdata);";
and Iframe
<iframe id="test001" src="" frameborder="0" hspace="0" ></iframe>
How can I use url from Obj-c to javascript on Iframe. Thanks for any Idea.
Update
I try to display data inside getdata
If I alert(getdata)
is show correct data.
but If I use this document.getElementById('test001').src = 'http://en.wikipedia.org/wiki/'+getdata;
getdata will show undefined : http://en.wikipedia.org/wiki/undefined
something like this. the problem is come from IOS or javascript advice me please.