How do you add a UIWebView (to load a live site, not an HTML page) to show as a sub-view of IASK?
I see this example in the sample app, but it is using a static local page.
Just put the http:// URL of the page into the File key instead of your local file name.
Related
I am not sure if this is grounds of app rejection or not:
In my app I receive JSON data from webserver and it has html content like
"[html] a href www.mycompany/view/regulations.html"... click for regulations...[/html]"
Is it okay to show the contents of the url above when clicking on "Click for regulations" link, or will this be rejected because I am under the impression that all html has to be carried locally?
That shouldn't be a problem. We have an app were our TOS is loaded from an (online) URL. What they usually don't like if your code loads from an external source.
I have a UIWebView in my view controller. This UIWebView shows a PDF file. I have created a button. When the user clicks on this button, I want to send the content of the UIWebView via email. As a template I use the MailComposer from Apple. In this template Apple isn't using a UIWebView. Apple uses local stored data which works fine. So I am looking to send the content of the UIWebView, my displayed PDF, but I don't know how to do this.
Thanks.
You could try using -stringByEvaluatingJavaScriptFromString: to get the HTML content of the page and using -setMessageBody:isHTML: to set the message body. You may want use a <base /> tag, though, to set the page's base URL so relative URLs function.
Edit
You could download the PDF and use addAttachmentData:mimeType:fileName: to attach the PDF to an email.
What you will need to do is download the pdf and save it on the device and then attach it as per Apple' example.
see one approach to downloading here
Does UIWebView auto prefetch pages?
This is my situation:
The main page is a local HTML file containing 3 links to other local HTML files. In one of them I have an iframe that loads a page from the Internet. Could the UIWebView be attempting to prefetch this page silently?
I'm inclining to no, but I haven't found a definite answer yet.
UIWebView mimics a browser page, so if you open a local file which has an iframe that references a remote page then yes the iframe will attempt to load the remote page but not until that page is loaded as the WebView's active html page.
I've put UIWebView in my app which loads login page, after user logs in, can I write some function that will copy specific link from that UIWebView that is specific for every user?
The best way to do this would probably be to include a JavaScript function in the page that returns the link or data you need. See [UIWebView stringByEvaluatingJavaScriptFromString:]
Another way could be to retrieve the HTML in your iOS code, get the data you need, and then set that content in the UIWebView using the loadHTMLString:baseURL: method.
I'm trying to cache the mobile Gmail webpage because UIWebView does not cache the content itself (mobile safari does, but not UIWebView).
I tried the methods listed here Reading HTML content from a UIWebView basically saving the html either directly from URLRequest or from UIWebView itself. When I try to put the html saved back into UIWebView it is not the same page!
This is the page that I want to save
alt text http://img39.imageshack.us/img39/5679/screenshot20090830at123.png
This is the page that the html saved will display
alt text http://img39.imageshack.us/img39/8734/screenshot20090830at122.png
If you're loading using loadData:MIMEType:textEncodingName:baseURL: make sure you're setting baseURL correctly - that way, the WebView will know where to look for relative stylesheets and so on.
Edit: For example, if I was saving this page, I'd set the base URL to Just can't seem to fetch the mobile Gmail html, what is wrong?.
That looks like the same page to me, but with different stylesheets attached. If you're just re-displaying identical HTML from your local server, the relative stylesheet paths in Google's HTML would no longer be correct. Also, any AJAX requests meant to run after the page loads would no longer work (both because the relative paths to the scripts would be wrong, and also because Cross-Site Scripting restrictions would prevent them from contacting Google).
Attempting to scrape content from an AJAX-enabled application is no small undertaking. You'd have to replicate a lot of GMail's functionality to truly reproduce the exact page Google presents.