0

I have created a web view app in swift. There I came up with one issue that following click event is not working.

<button onclick=" window.open('https://www.google.com/','_blank')"> click + </button>

It seems to be only window.open() having that issue in ios devices for the ios app. Any way to fix this?

Jack
  • 259
  • 4
  • 18
  • 1
    A web view (`WKWebView` or `UIWebView`) doesn't have a concept of multiple windows like `Safari` does. What is the effect you're hoping the action will have? – jnpdx Jan 25 '22 at 05:40
  • Have you enabled javascript for the web view? – Ricky Mo Jan 25 '22 at 05:40
  • Please make sure your code doesn’t use smart quotes (`“”` and `‘’`). See [What is the difference between “ " quotes in javascript?](/q/45766066/4642212) and [Simple HTML page not loading Javascript Hello World](/q/22713330/4642212). Inline event handlers like `onclick` are [not recommended](/q/11737873/4642212). They are an [obsolete, hard-to-maintain and unintuitive](/a/43459991/4642212) way of registering events. Always [use `addEventListener`](//developer.mozilla.org/docs/Learn/JavaScript/Building_blocks/Events#inline_event_handlers_%E2%80%94_dont_use_these) instead. – Sebastian Simon Jan 25 '22 at 05:45
  • already enabled js @RickyMo – Jack Jan 25 '22 at 06:03
  • already using correct quotes. Sorry, I'll update the code in the question. @SebastianSimon – Jack Jan 25 '22 at 06:05

0 Answers0