Tag Archives: webview

Is it possible to send a hash tag to a file url in UIWebView?

Questions: I want to load a html page from a file, and append a hash tag to it. Is this possible? I have tried NSString *filePath = [[NSBundle mainBundle] pathForResource:@”someFile” ofType:@”html”]; NSURL *fileUrl = [NSURL fileURLWithPath:[filePath stringByAppendingFormat:@”#hashtag”]]; [self.webView loadRequest:[NSURLRequest requestWithURL:fileUrl]]; NSLog(@”fileUrl = %@, reachable? %d”, fileUrl, [fileUrl checkResourceIsReachableAndReturnError:nil]); but this tries to look for the… Read More »

Resize images in UIWebView to viewport size

Questions: I’m displaying HTML with some images inside a UIWebView in my iPhone App. When the images are wider than the viewport of the iPhone I get horizontal scrollers which I don’t want because its mostly about the text not the images. Is there a way to resize images displayed inside the UIWebView according to… Read More »

Is it possible to send a hash tag to a file url in UIWebView?

Questions: I want to load a html page from a file, and append a hash tag to it. Is this possible? I have tried NSString *filePath = [[NSBundle mainBundle] pathForResource:@”someFile” ofType:@”html”]; NSURL *fileUrl = [NSURL fileURLWithPath:[filePath stringByAppendingFormat:@”#hashtag”]]; [self.webView loadRequest:[NSURLRequest requestWithURL:fileUrl]]; NSLog(@”fileUrl = %@, reachable? %d”, fileUrl, [fileUrl checkResourceIsReachableAndReturnError:nil]); but this tries to look for the… Read More »

Resize images in UIWebView to viewport size

Questions: I’m displaying HTML with some images inside a UIWebView in my iPhone App. When the images are wider than the viewport of the iPhone I get horizontal scrollers which I don’t want because its mostly about the text not the images. Is there a way to resize images displayed inside the UIWebView according to… Read More »

Mobile Safari-style back button for UIWebView?

Questions: I haven’t been able to find any sort UIBarButtonSystemItem representing tha “Back” button in Mobile Safari. I want my UIWebView’s controls to look just like the ones in Mobile Safari so it makes sense. Would the best solution be to just screenshot UIBarButtonSystemItemPlay (same image as the Forward button) and flip it? Thanks. Answers:… Read More »

When did caching in a UIWebView start working?

Questions: I’ve been testing an iPhone view controller that uses a UIWebView to load external content, as opposed to resources in the project’s bundle. Another engineer noticed that the web view wasn’t caching at all, so I went into do some research. Some older questions indicated that UIWebView’s just couldn’t cache external content. Previous SO… Read More »

Running JavaScript in a UIWebView before any other JavaScript is run

Questions: I have a UIWebView component that is going to load a webpage which might contain JavaScript. I want to run some JavaScript of my own before any JavaScript on the loaded webpage runs. I know I can use [myWebView stringByEvaulatingJavaScriptFromString:] on the webViewDidFinishLoad: delegate of the UIWebView, however this will only run my JavaScript… Read More »