Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
This article is on how to show an Alert view in UIWebView.
The weblinks containing the pop-ups or alerts can be handled in WebKit.
UIWebView delegate functions can handle the alert elegantly in the iOS application.
So let’s start learning.
Integrating Alert View in Weblink
Firstly let’s create a web link that contains an alert view.
Go to our favorite website W3School
It’s time to add the code to display the alert on the website.
Add the below code for displaying the alert view on the website.
Now hit run in the editor, and you will see the webpage with a button named “Show Alert”
Now click on the Show Alert button, and you will see a pop-up on the webpage as below.
Copy the web link, we have to open this inside our UIWebview in Swift.
Now let’s Show an Alert View in UIWebView.
Integrating Alert View in UIWebView
We will open the copied web link on the previous section inside our UIWebView in Swift.
Create an Xcode project and add UIWebView in your ViewController class as below.
Now add the WebView function runJavaScriptAlertPanelWithMessage that will actually handle the displaying of the alert in our application.
This will pop up an alert view in our application as shown below.
Now you are done integrating the Alert view in UIWebview.
That’s all for this article.
We hope you liked the article.
Please visit my other blogs here.
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Excellent work, fast, good quality and understood the brief perfectly! Quick responses developing the project and very good cooperation. I suggest to anyone.
Stathis Plakidas
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.