禁用UIWebView中的警报框 [英] Disable the Alert Box in UIWebView

查看:51
本文介绍了禁用UIWebView中的警报框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在UIWebView中加载一个外部网页.网页加载后,将出现一个警告框(带有确定"和取消"按钮),其中包含有关该网页的一些建议/信息".当网页加载到我的iPhone应用程序的UIWebView组件中时,我想阻止此警报框.如何在我的代码中实现?

I am loading an External web page in the UIWebView. When the web page loads, there is an Alert Box ( with OK and Cancel buttons) with some Suggestion/ Info about the web page. I want to block this Alert Box when the web page loads in the UIWebView component in my iphone app. How can I implement in my code?

感谢您的答复.我不负责外部网页(但是我可以请关注的网页所有者针对以下要求进行更改).要求是,当我们在iPhone Safari浏览器中查看网页时,可以显示警报框(用于告知我的iphone应用程序),而在我使用iphone应用程序的UIWebView中不能查看该警告框.我在iPhone Safari和带有UIWebView的iPhone应用程序中都使用了相同的网页URL.因此,要求是当我们在iPHone Safari中查看网页时显示警报"框,而当我们在iPhone应用程序中(在UIWebView中)查看同一网页时不显示警报"框.希望我已经清楚地解释了我的要求.请为此提供任何解决方案.

Thanks for your reply. I am not in-charge for the external web page(but i could ask the concern web page owner to do the changes with respect to following requirement). The requirement is that the Alert Box (used to tell about my iphone app) could be shown when we view the web page in iPhone Safari browswer , but not in UIWebView in which I am using the same web page) of my iphone app. I am using the same web page url both in iPhone Safari and in my iPhone app with UIWebView. So requirement is show the Alert box when we view the web page in iPHone Safari and don't show the Alert box when we view the same web page in iPhone app (within in UIWebView). Hope I have clearly explained my requirement. Please give any solution for this.

推荐答案

使用 stringByEvaluatingJavaScriptFromString:方法,您可以使用提供的任何javascript更改页面上所需的任何内容,这样就可以重载或替换警报功能可做您想要的

using stringByEvaluatingJavaScriptFromString: method you can change anything you want on the page with any javascript you provide, so you can overload or replace the alert function to do what you want

这篇关于禁用UIWebView中的警报框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆