Hi All
I have a synchronization problem. I execute js in timer.so this js code repaint the text which is loaded in my (html) webview. the code works fine but
in some case when I repaint the text I need do some thing with data base.
for this in my js I change the window location
window.location = '/playSong/1';
after this action called the next function (1)
function 1
The problem.
I lose the text that should be repainted.
How synchronization this two action repaint and working with data base?
and this line did not work too.
document.getElementById('Text').innerHTML=row.replace(row.substr(0,1),'');";
I have a synchronization problem. I execute js in timer.so this js code repaint the text which is loaded in my (html) webview. the code works fine but
in some case when I repaint the text I need do some thing with data base.
for this in my js I change the window location
window.location = '/playSong/1';
after this action called the next function (1)
Code:
NSString *_script = @"
var song_list = new Array('play/song1' , 'play/song2', 'play/song3' , 'play/song4' , 'play/song5');
var pos = new Array(84,105,150,155);
var row=document.getElementById('Text').innerHTML;
var begin = document.getElementById('Text').innerHTML;
var end = document.getElementById('RedText').innerHTML;
var shift = begin.length + end.length;
for(var i = 0;i <= pos.length; i++ )
{
var len = row.length;
if(pos[i] == (shift - len) )
{ window.location = '/playSong/1'; }
}
document.getElementById('RedText').innerHTML+=row.substr(0,1);
document.getElementById('Text').innerHTML=row.replace(row.substr(0,1),'');";
NSString *result = [webView stringByEvaluatingJavaScriptFromString:_script];
function 1
Code:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
if ( [request.mainDocumentURL.relativePath isEqualToString:@"/playSong/1"] )
{
// do something
return false; // tell the webView to not do anything with the request
}
return true;
}
The problem.
I lose the text that should be repainted.
How synchronization this two action repaint and working with data base?
and this line did not work too.
document.getElementById('Text').innerHTML=row.replace(row.substr(0,1),'');";