Reputation: 160
hi all i am a new iphone developer. i am working on webview application from my URL i am getting alerts in the web browser but same url not showing alerts in the iphone web view as like web browser. how to apply the java script coding alerts in the iphone web view?. thank you in advance.
Upvotes: 1
Views: 180
Reputation: 37581
If the Javascript is yours then instead of calling the alert you could instead call a function that calls Objective C and invoke an iOS native alert.
If the Javascript isn't yours then using UIWebView you can inject some Javascript to override the default behaviour and change it to call an iOS native alert i.e. something like this
window.alert = function(message) {
window.location = "myScheme://" + message"
};
Then look for myScheme and extract message in UIWebView's shouldStartLoadWithRequest
Upvotes: 1