uiwebview

iOS UiWebView “Frame load interrupted”

匆匆过客 提交于 2019-12-01 14:42:08
I have a UiWebView that is pointing to an external site that has a session expiration of 30 minutes of inactivity. In my app, I have a custom login page embedded in the application because I can't use one from the remote site. This login page is: file://index.html When the user puts the app into the background, I want to automatically reload my login page if the application stays in the background for more than 20 minutes (I know this isn't ideal, but forced to do this because of the business requirements). My code to do this is fairly simple: static NSDate *lastActivity = nil; - (void

(lots of) UIWebView memory leaks

余生长醉 提交于 2019-12-01 14:31:00
I've seen from other posts that there are memory leaking issues with UIWebView. However, with the amount of objects that I have leaking, I have to wonder if I'm doing something wrong. 'Leaks' reports about 60 leaks for opening a UIWebView, loading a page and closing (it's the Facebook login page). I've check the stack trace for every one of these objects, and they never touch my code. They're all either in a separate thread (I only use the main thread), or go from 'main' to a bunch of internal methods that are greyed out. Is this expected from UIWebView? I'm running the latest firmware, and I

Why PDF not opening in iFrame in Chrome when switched to Mobile Device Mode

孤人 提交于 2019-12-01 13:45:34
This shows the pdf when we open it in browser. <html> <head> </head> <body> <iframe src="https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/44678.pdf" width="100%" height="100%" > </iframe> </body> </html> But when I switch it to mobile view, it DOESNT work. Steps: Open Chrome Inspect Window. Click "Toggle Device Toolbar" icon on the top menu on inspect window toolbar. Now we can still see the pdf in mobile view. Once we refresh it, we can NO LONGER SEE pdf. Why ? I need to iframe the pdf and show it in mobile app in web view. Is it possible or not ? 来源: https:/

display specific pdf page in the UIWebview ios

坚强是说给别人听的谎言 提交于 2019-12-01 12:39:55
I am currently working on a project and I have ios need to display a pdf file. However i want choose the page to display. For example see page 10 of 37 in a UIWebView. I have not found a way to cleanly separate the pages of a pfd. thank you for your help. You can use setContentOffset property of webview to show that page, [[webView scrollView] setContentOffset:CGPointMake(0,10*pageheight) animated:YES]; where pageheight=your page height, 10 is your page no, Use UIWebView's delegate method to do this: - (void)webViewDidFinishLoad:(UIWebView *)webView { //Check if file still loading if(!webView

How do I call an Objective-C method from JavaScript on UIWebView? [duplicate]

家住魔仙堡 提交于 2019-12-01 12:34:30
问题 This question already has answers here : Closed 8 years ago . Possible Duplicates: How to call an Objective-C method from Javascript in a Cocoa/WebKit app? How to call Objective-C from Javascript? Is there a way to call Objective-C code from JavaScript on UIWebView ? In Android, I am able to call an Android method from a web view's JavaScript script, which handles navigation to another page in the application. How would I do this in iOS? 来源: https://stackoverflow.com/questions/7171163/how-do

Knowing when AJAX has loaded in UIWebView

可紊 提交于 2019-12-01 12:26:17
问题 I have a UIWebView and one page has an AJAX component whose content changes when the user clicks a button. How can I know when the content has loaded inside the UIWebView ? 回答1: You'll need to do two things: In your JavaScript code, have the XMLHTTPRequest signal that the AJAX request is complete with a custom URL: var req = new XMLHttpRequest(); req.open('GET', 'http://www.mozilla.org/', true); req.onreadystatechange = function (aEvt) { if (req.readyState == 4) { if(req.status == 200) {

How to detect keyboard enter key?

痞子三分冷 提交于 2019-12-01 12:22:03
I have on UIWebView in that i am allowing editing at runtime. Now when i click on UIWebView then iPad keyboard opens for writing, now my requirement is how to detect that I have clicked on enter key of iPad keyboard?. I know that we can achieve this if we are editing in UITextView or UITextField with using it's delegates.Help me! I have one function in javascript that detects it. function returnEnterPress(e){ var key; if(window.event) key = window.event.keyCode; //IE else key = e.which; //firefox // ENTER KEY MUNBER IS 13 // KD if(key == 13) { //alert('enter'); } return false; } Now can i get

Problem calling a Local HTML File from XCode

南楼画角 提交于 2019-12-01 12:16:39
Here's my WebView Code: [webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath: [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]isDirectory:NO]]]; Here's my Error: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:isDirectory:]: nil string parameter' Can anyone help? It's saying nil string but the NSURL string is index.html My only thought is that perhaps the index file isn't stored correctly. It's in the project directory - the same folder as the XCode project file xcodeproj and the info.plist

iOS UiWebView “Frame load interrupted”

旧城冷巷雨未停 提交于 2019-12-01 12:11:19
问题 I have a UiWebView that is pointing to an external site that has a session expiration of 30 minutes of inactivity. In my app, I have a custom login page embedded in the application because I can't use one from the remote site. This login page is: file://index.html When the user puts the app into the background, I want to automatically reload my login page if the application stays in the background for more than 20 minutes (I know this isn't ideal, but forced to do this because of the business

load local HTML file when link is clicked in WebView

徘徊边缘 提交于 2019-12-01 12:08:28
I have a WebView that loads a local HTML file like this: [webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"test1" ofType:@"html"]isDirectory:NO]]]; What I want is to click a link in the test1 local HTML file and then for the webView to load the test2 local HTML file. How can I do this? Like in a regular webpage. Let the link in test 1 point to test2. Instead of loading a request, use the - (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL method. Create an NSString from the local HTML file like this: NSError *error