Why isn't CSS being applied within my UIWebView? - iphone

When I try to display a local HTML page un a UIWebView, the CSS for that page is not being applied. However, when I load that same page in the regular Safari, it is. What could be causing this?

I assume you are using loadHTMLString to populate the content of the UIWebView? Is your CSS embedded in the HTML that you are loading into the view? If it references a file online, check that the URL file is the full path (not just the relative path).
If the CSS is referenced using a relative path it will work fine in the browser, but not in a UIWebView with statically loaded content.

Related

JavaScript along with the HTML file is not running in UIWebView

I have placed the HTML Resource files and java script files with the project files in my iphone application. My objective is to build an application which has UIWebview which loads when we tab on the app icon. The UIWebView should actually load the local html content that I have in the resource folder. I can see the HTMl content in the webview but its not running the Javascript..
Checkout stringByEvaluatingJavaScriptFromString: in the
UIWebView Class Reference
Her the actual problem comes with adding the files(javascript and css) in the project. while adding files following option should be clicked that showed in the following image.

Force All Image<img> on UIwebview Display In Progressive Mode

Is there have any way to do this ? I am trying load some local file in the UIwebview, if the content include Image, loadHTMLString is taking much longer to finish page loading just because have to waiting the download of image file.
As I think if the image can be load in progressive mode, the UIwebview can display the html text on the very beginning to prevent the user keep too long time to waiting for the whole page loading.
P.S. The Image is from the internet,but the html string is on the local file
All you need to do is to have the images to be loaded in the Progressive JPEG format. To convert them using ImageMagick you can type:
convert somefile.xxx -interlace JPEG somefile_progressive.jpg
for example.
Another possible solution could be to load the images using JavaScript, once the page has been loaded fully.
Ie just leave the src blank in the html and set it via JavaScript later.
I would really use Javascript. You'd show a blank page or one with just a part of your content and after your document is ready (maybe use jQuery?) you load the other content.
document.getElementById('content1').innerHTML = "<img src="./images/something.png" alt="" />"

Save content of UIWebView

I am working on an app and I need to save the content of UIWebView.
I currently Use stringByEvaluatingJavaScriptFromString:#"document.getElementsByTagName('html')[0].innerHTML"
to get the html of the UIWebView, but the problem with this method is that it does not save the full content of some webpages.
So my question is How do you save the full content of a webpage including images and css
I think there is already a thread about this topic here:
iphone uiwebview download complete page with CSS and Images
Hope that helps.

using YUI3 tabview in zend framework

i try to use the YUI3 tabview widget in zend framework.
i use the Yahoo CDN to load all the modules, every things is fine, i got the combo with tabview.css inside except that i can't download the image file that is used in the tabview.css.the same code works fine in a plain html file and the image is right there. why this is happening?
here is a test page http://www.ceshi.anpingsiwang.info, the tabview.css is in the css combo, the full url of tabeview.css is http://yui.yahooapis.com/3.3.0/build/tabview/assets/skins/sam/tabview.css. you can see there is a image called sprite.png is used in that tabview.css file, but it was not loaded. the other plain html file http://www.ceshi.anpingsiwang.info/plain.html is totally fine
The <body> element is missing the class attribute. Just change
<body>
to
<body class="yui3-skin-sam">
and you're golden (and I'm off to sleep).
Edit demo demo demo!

iphone webview show html with images and css file

I found some interesting URL http://cubiq.org/rotating-wheel-for-your-iphone-webapps which has rotational menu. Its good. It has html file along with images, css files etc.
In iPhone app, I copied (to root folder) all the files and imported to project. I'm using UIWebView's load request to load the html. But I'm not getting the rotatable menu.
Can some one post me the code (or tutorial or prototype or example) on how to use it?
Also let me know how to catch the even on click on "OK" button at the middle of the html.
Thanks in advance.
checkout IUI : http://code.google.com/p/iui/