This stackoverflow question appears to have one or two answers that may help you.
Up vote 2 down vote favorite share g+ share fb share tw.
I'm looking for a way to load my UIWebView with a local CSS file that should affect on the UIWebView's loadRequest. For the clearness: I have an UIWebView that I loadRequest it with a website url. I also have a local CSS file that should affect this loadRequest url.
I want to load this CSS file onto the UIWebView. Thanks, iphone objective-c css ios uiwebview link|improve this question asked Jul 29 '11 at 12:25user54607413119 95% accept rate.
This stackoverflow question appears to have one or two answers that may help you. You need to load the local CSS (using a method not unlike @Shrey uses, but looking for your CSS file), and somehow inject it into the page, and the only way appears to be to use: webview stringByEvaluatingJavaScriptFromString:someJavascriptToInjectCSS; and some clever Javascript to modify the page to add the CSS in. Hope this helps point you in the right direction.
I have used this method to inject stuff into pages, so it does work, but I don't know Javascript well enough to write the code to inject your CSS into the page.
Sorry, I messed up the link on the answer - now edited. There is an answer on that page which appears to do what you want, in including the js. – iandotkelly Jul 29 '11 at 15:59 Thanks, but is it possible to apply custom css files on UIWebView that loads sites such as Google or should I give up for this option?
– user546074 Jul 29 '11 at 16:09 Yes, you can use the answer in the SO question - the answer I am referring to is: stackoverflow.com/questions/1893715/… This answer shows loading of a CSS from a local file and injecting it into the web-view. – iandotkelly Jul 29 '11 at 16:13.
Try this: WebView loadRequest:NSURLRequest requestWithURL:NSURL fileURLWithPath:NSBundle mainBundle pathForResource:@"index" ofType:@"html"isDirectory:NO.
Don't think that's going to do what OP is asking for. For starters it is a local CSS file they want to load, not an html file, then they want to inject the CSS into a page that doesn't reference it. – iandotkelly Jul 29 '11 at 14:57 Then try using webview delegate methods.
– iShrey Jul 29 '11 at 15:04.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.