Search code examples
javascriptiosxcodeuiwebview

iOS - print javascript as text in uiwebview not to execute


><svg/onload=alert(document.domain)> i want to print this text in uiwebview. Right now it gives me alert "myapplication.app" and not showing any text.

To load html string i am using [webView loadHTMLString:HtmlString baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]]; this code.

Basically i want to print javascripts as text in UIWebView and don't want them to get execute. Thanks.


Solution

  • Well i could not find any solution for this. The only reason i was using UIWebview is to show html links. But as UITextview also can show links i changes element from UIWebview to UITextview. Which solve the issue of executing javascript text.