Webview
delegate shouldstartloadwithrequest
recieves url from HTML and when i check the request everything is been converted to small letters:
- (BOOL) webView: (UIWebView *) webView shouldStartLoadWithRequest:(NSURLRequest *) request navigationType: (UIWebViewNavigationType) navigationType {
// Only do something if a link has been clicked
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
NSString *link = [[request URL] absoluteString];
if ([link hasPrefix:@"playSound:"]) {
[PlayAudio playAudio: [link substringFromIndex:10]];
return NO;
}
}
return YES;
}
The line that make the problem is
NSString *link = [[request URL] absoluteString];
Before I got an unmodified copy of the clicked link. In iOS3 and iOS4 it is still the same. But on iOS5 it is converted to lowercase only. The next Line
if ([link hasPrefix:@"playSound:"]) {
never becomes true. So I had to change the code to
- (BOOL) webView: (UIWebView *) webView shouldStartLoadWithRequest:(NSURLRequest *) request navigationType: (UIWebViewNavigationType) navigationType {
// Only do something if a link has been clicked
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
NSString *link = [[[request URL] absoluteString] lowercaseString];
if ([link hasPrefix:@"playsound:"]) {
[PlayAudio playAudio: [link substringFromIndex:10]];
return NO;
}
}
return YES;
}