Guest User

Untitled

a guest
Apr 15th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <script language="javascript">
  2. alert("Hell! UIWebView!");
  3. </script>
  4.  
  5. - (void)login {
  6. NSString *requestText = [[NSString alloc] initWithFormat: @"%@?user=%@&password=%@", DEFAULT_URL, user.name, user.password]; // YES, I'm usin GET request to send password :)
  7. NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:requestText]];
  8. [webView loadRequest:request];
  9. }
  10.  
  11. webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:
  12.  
  13. @interface UIWebView (JavaScriptAlert)
  14.  
  15. - (void)webView:(UIWebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame;
  16.  
  17. @end
  18.  
  19. @implementation UIWebView (JavaScriptAlert)
  20.  
  21. - (void)webView:(UIWebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
  22. UIAlertView* dialogue = [[UIAlertView alloc] initWithTitle:nil message:message delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil];
  23. [dialogue show];
  24. [dialogue autorelease];
  25. }
  26.  
  27. @end
Add Comment
Please, Sign In to add comment