uiwebview

UIWebView not displaying my webpage

早过忘川 提交于 2019-12-07 23:54:31
问题 For some background info, the webpage I'm trying to display is a web app currently being hosted on AWS's EC2. The backend is Python w/ Flask and the frontend is just simple HTML/CSS. The URL has HTTP, as it isn't secured with HTTPS yet. When the url for this webpage is opened, the first thing the browser asks is for login credentials (the browser asks, not the website). This page does load in mobile Safari on my iPhone, and Safari does successfully ask for the credentials. If I enter them in

Using One or More Formatters with a Page Renderer in iOS

假装没事ソ 提交于 2019-12-07 23:54:23
问题 Has anyone tried using multiple formatters ( UIViewPrintFormatter , UIMarkupTextPrintFormatter , UISimpleTextPrintFormatter ) with a page renderer ( UIPrintPageRenderer ) to print the content? I'm trying to use two UIMarkupTextPrintFormatters with a UIPrintPageRenderer subclass, but i'm failing to get the print. I'm using MyPrintPageRenderer class from PrintWebView sample code. I've gone through the Apple's documentation but it isn't very helpful, and there is no sample code associated with

WKWebView is not loading resources when not presented

荒凉一梦 提交于 2019-12-07 23:42:00
问题 I am trying to shift my app from UIWebView to WKWebView. When the app starts, my App is downloading an HTML file to the file system. When the download is over, a webview object is created (not presented on screen) and loading the HTML from the device (“file://“). The HTML contains javascript that loads resources from URLs according to certain params. Here is the issues: In UIWebview, all resources are loaded without a problem. In WKWebView there is a weird behavior: If the object (WKWebView)

UIWebview size limit

試著忘記壹切 提交于 2019-12-07 21:18:57
问题 Everytime I load a html file that is larger than 2MB my app crashes. Is there a limit to how big a web page can be? How can I not crash my app (partial loading?) 回答1: When you load 2MB of HTML, the UIWebView has to consume a lot of memory to create a DOM and all of the controls/graphics/etc. to actually show the page. The limit is not the HTML size, but the resulting amount of memory that is needed to display it. Run it in the simulator with the Activity Monitor to see memory consumption

anyway to delete all <a href=> tags with javascript after the page loads on an iPad?

我只是一个虾纸丫 提交于 2019-12-07 21:07:43
问题 I know that I can run a line of javascript code after the page loads on an iPad with UIWebView (which is what I am using), but I do not know what I could type to go through and remove all of the tags. I also would like to be able to do this to only certain parts of the page e.g. only remove tags within a certain tag. 回答1: You can get all elements by tag name using document.getElementsByTagName(). All links have the tag name a . You can visually remove them by setting their display style to

HTML5 AppCache in UIWebView

旧城冷巷雨未停 提交于 2019-12-07 19:28:26
I'd like to make use of appcache in my native application on the iPhone. Though Mobile Safari supports appcache it seems that the UIWebView that you can embed in an application does not. I know with a bit of work, I could simulate some sort of appcache like functionality in my application, but this isn't good enough - I'd like access to the same appcache that Mobile Safari uses. I'd be willing to use some of the Private Frameworks in the iPhone SDK, as getting this working is a much higher priority than being able to submit to the app store. Thanks! 来源: https://stackoverflow.com/questions

Why would a link in a UIWebView leave a gray box behind?

风格不统一 提交于 2019-12-07 19:26:38
问题 I have a UIWebview that I am loading with custom HTML using loadHtmlString. My HTML has a link that I intercept when tapped so that I can take control and reload the UIWebview with a different HTML string. The code works, but the area where the link text was located is replaced with a gray rectangle that is visible when the new string is loaded. What could be going on here? How can I get rid of this behavior? //Scott 回答1: Here it is...need to add this style statement to the link reference: <a

WKWebView/UIWebView get website icon

孤人 提交于 2019-12-07 18:57:02
问题 How can I get the apple-touch-icon or logo of the website using WKWebView or UIWebView? I've read that getting a favicon is possible, however I plan on using the website's logo as a short cut like in iOS Safari and a favicon is too small for it. Is there a way to scrape metadata from a website in webView to get <link rel="apple-touch-icon" href="apple-touch-icon.png"> ? 回答1: In Firefox for iOS we use a User Script (Link to code on Github) to find the icon that then passes them back to the

Calculate UIWebview height in UITableViewCell with twitter embed tweet

谁说胖子不能爱 提交于 2019-12-07 18:55:15
问题 I'm loading an html to a webview, that can contain embed links to twitter, vimeo, youtube, or just plain simple html. Just for test purpose, i've created a simple view using the same way i'm calculating the height, and i have a table view the is dependent of the height calculated to show the webview correctly. The problem is that calculated heights are wrong, so embed html is not displayed in correctly. This are the relevant prats of my code: -> This loads html string in dummy webview, the

Load Javascript files through HTML file on WKWebView in iOS

為{幸葍}努か 提交于 2019-12-07 18:26:28
问题 I have a requirement of loading Javascript files through HTML file. I have structured files in order shown in below screenshot. HTML head tag contains the Javascript files to call as below: <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <script type="text/javascript" src="AjaxCapturer.js"></script> <script type="text/javascript" src="authenticate.js"></script> </head> So I have been using UIWebView to load the page and its loading properly as