uiwebview

How to get image data on touch inside UIWebView in iOS

只谈情不闲聊 提交于 2020-01-03 04:49:05
问题 Inside UIWebView, I want to get the html data of the image when the user clicks the image on the web. When I say html data, I mean data as below: <img data-sz="f" name="QC6TSb_zoErN3M:" class="rg_i" alt="blahblah" jsaction="load:str.tbn" src="data:image/jpeg;base64,/9j/blahblah//9k=" style="width: 289px; height: 152px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"> just like the way you can do with developer tool inspector on your PC web browser (In fact, all I need is inside the src

Deciding height for UIScrollView with UIWebView inside

随声附和 提交于 2020-01-03 03:44:06
问题 I have a detail view where I want to show a title, subtitle and content for articles. I want to be able to use HTML to format the text, so I've used a UIWebView for showing the article body. This works perfectly. How ever, all of this, is inside a UIScrollView, so my issue is that I have to calculate the height of the UIScrollView? This is how it works today: And this is how it looks like in Storyboard: So what I need to find out, is what is the correct code and syntax to calculate the

UIWebView - scaling image independently from text

孤者浪人 提交于 2020-01-03 02:46:05
问题 I would like to diplay HTML in iPhone UIWebView. My HTML looks like text text <img src.../> text text How can I cause the component (via JavaScript or Objective C) to fit the image size to a window - i.e text size will remain the same but image will be reduced/enlarged proportionally to prevent horizontal scrolling ? Thanks 回答1: You have to know what the HTML looks like, because the only way to do that is to manipulate the DOM. On the Mac you could access the DOM via Objective C, but that API

How can I know when the Magnifying Glass comes up in UIWebView?

我是研究僧i 提交于 2020-01-02 23:08:35
问题 How I can detect when the magnifying glass comes up in a UIWebView? 回答1: Assuming you're writing an app to release on the app store, you can't - the structure of a UIWebView is opaque to you, and you can't drill down into its component parts. Whilst I suspect it would be possible to descend into its structure and figure out exactly what was getting triggered when, you run a very large risk that Apple will change UIWebView's structure in a subsequent OS update and break your app. So unless you

Detect whether UIWebView needs to use HTTP or HTTPS

£可爱£侵袭症+ 提交于 2020-01-02 21:54:08
问题 How do I detect whether a web page in a UIWebView needs to use HTTP or HTTPS? I have an address bar where the user can type in "www.apple.com" and then I convert this to a NSString with http:// in front of it. If Apple.com requires HTTPS though, how would this be handled? What exactly should I do? Thanks for your help! 回答1: In most cases, a web site that requires HTTPS is set up to automatically redirect to the correct SSL port. In generally goes like this: Enter the URL http://www.mysite.com

UIWebview load different files switch langage

落爺英雄遲暮 提交于 2020-01-02 20:46:42
问题 I have differents embedded HTML files in different languages. I'd like to load the correct files in a webview based on the current langage. Is there a way to do that as easily as NSLocalizableString? thanks 回答1: If you use "localized resources", for example english version of "index.html" in "en.lproj/index.html", french version of "index.html" in "fr.lproj/index.html", then many resource functions will automatically select the correct version (based on the user's language setting), e.g.:

UIWebview load different files switch langage

假如想象 提交于 2020-01-02 20:45:35
问题 I have differents embedded HTML files in different languages. I'd like to load the correct files in a webview based on the current langage. Is there a way to do that as easily as NSLocalizableString? thanks 回答1: If you use "localized resources", for example english version of "index.html" in "en.lproj/index.html", french version of "index.html" in "fr.lproj/index.html", then many resource functions will automatically select the correct version (based on the user's language setting), e.g.:

NSExceptionDomains xcode 8 not working

妖精的绣舞 提交于 2020-01-02 18:54:52
问题 I am using a UIWebView to show a email subscription sign up page. It is not a https:// page so I obviously need to make an exception. I don't want to set it to NSAllowsArbitraryLoads because it is only one page in the whole app and the app may get rejected. So I have used the code below in my info.plist file but I still get the error. Lots of stackoverflow answers point towards this code however I can't get it to work in xcode 8/ ios 10. App Transport Security has blocked a cleartext HTTP

Youtube iFrame API pauseVideo is undefined in UIWebView

南楼画角 提交于 2020-01-02 16:54:11
问题 I am developing an app for iPad which contains one or more youtube videos embedded in a UIWebView. I am using the Youtube iframe API. The video shows up fine and the user can use the normal controls fine. However, I want to pause the video when an external event happens. I am attempting to do this by using stringByEvaluatingJavascripFromString with "player.pauseVideo()". However, on inspection it appears that player.pauseVideo is undefined. Strangely this only appears to be a problem in the

iOS Swift : can't Retrieve current url loaded in UIwebView

送分小仙女□ 提交于 2020-01-02 07:15:10
问题 i am working in webview application iOS swift : problem i am facing is i want to get each url which webview displays : upon urls i have to perform some if else checks . but i could not get the urls which webview loads. webview is displaying fine results and loading urls upon clicking . i want to fetch all urls which webview navigates on.. import Foundation import UIKit class seconVC: UIViewController { var toPass:String! var touser:String! var toPassing:String! @IBOutlet weak var webV: