WKWebView does not load http URL in iOS 10 and above, html pages are not rendered - swift

I am trying to load a http URL in WKWebView, the page loads perfectly fine on enabling NSAllowsArbitraryLoads and NSAllowsArbitraryLoadsInWebContent in info.plist file. But during navigating the Application, html pages are not loaded completely and my custom spinner doesn't disappear.
I have tried to NSExceptionDomains but no luck.
Everything works fine when I tried to load url with https://myurl
Please suggest

I found answer to my above question
history.back() was not working on HTML back button in iOS 11. Adding history.go(-1) worked for me.

Related

Flutter webview is not showing image even thou it's so simple html

I am making a Flutter app, and I am using webview here.
It all goes fine but when it comes to image, it just fails.
Other text contents are all fine.
I tried several things but all failed.
You can replicate the test by this url
It appears fine from the browser but images never appaer only in flutter webview
This is my flutter code for the webview
I found the answer by myself. It was because the image source was referred as "http:". I just put the following tag and it solved like a charm

Jquery-mobile messes up css background images on the iphone browser and UIWebView

When I add the jquery-mobile javascript to my site some of the background css images fail to load until I go to a different page and come back to the home page.
<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
The second I delete the import line, the images load fine. What might be the issue?
This issue only appears on the ios safari browser and a UIWebView. Works fine in a PC browser.
Seems like it was a jquery-mobile bug. Switching to the latest beta version did the trick for me:
<script src="http://code.jquery.com/mobile/1.2.0-beta.1/jquery.mobile-1.2.0-beta.1.min.js"></script>

PDF doesn't show in UIWebView after Renamed App

I have an App that displays a PDF in a UIWebView that is stored in the App itself.
All working fine! Until I renamed my App. The App started off being called PDFApp, then I changed it to Micro PDF, and again all worked fine.
the client then changed their minds and wanted it to be called "MIC Flooring", but when i do this the PDF does not load in the UIWebView. Very weird! everything else works as expected. If I changed the named back to Micro PDF then it works fine again.
Does anyone know why this may be happening?
Thanks
Sam
I found that you cannot have a space in your Project name - this was making the App not work properly.
instead change the Project Name to be something like - "MyAppName"
and change the 'Bundle display name' in the plist

iPhone UIWebView problem

I am trying to write an application to show a web page in a web view for this link:
http://just4u.safeway.com
But the page can not be shown in the UiWebView, I got a message:
This page contains the following
errors: error on line 90 at column 11:
AttValue: " or ' expected.
Can someone let me know what could be the problem? I already added code to handle redirect, but still get the same problem.
Thanks
Try explicitly setting the MIME type of the page to be "text/html". Otherwise it may be parsed in the UIWebview as xhtml. Also check that your <!DOCTYPE> is not claiming to be xhtml.
I was running into a very similar problem.
I was using the loadRequest method of UIWebView, which was causing the UIWebView to interpret it as XHTML.
I instead used NSURLConnection to asynchronously load the data for the webpage, then used
[webView loadData:downloadedData MIMEType:#"text/html" textEncodingName:#"UTF-8" baseURL:[NSURL URLWithString:pageURLString]];
and got the page to display without the pink error box at the top.
This is essentially the same solution as PengOne suggests - I just wanted to confirm that the suggestion works fine, and show the sample code that worked for me.

No response after submitting form on iPad from UIWebView

I am currently opening a webpage in UIWebView and submitting a form which performs a query on the server side and youtube video is returned (if available). I have no say/control over the server side implementation.
This webview works fine on iPhone/iPod, however, when I try to run the same app on iPad there is no response after submitting the form.
I created a dummy app, compiled on iOS 3.2 and problem is still there.
I put NSLogs in webview delegate methods which shows that after the form is submitted (UIWebViewNavigationTypeFormSubmitted) nothing happens.
I'm unable to figure out why this happens only on iPad and not on iPhone/iPod Touch.
I have created the webview in IB and setting the URL is viewDidLoad
[viewTourWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:#"http://www.realestatetour.com/mobiletours.htm"]]];
The URL for reference is http://www.realestatetour.com/mobiletours.htm
Enter the Tour ID as 10.
Thanks
The reason it wasn't working is because the form opens the result in a new page, (i.e. _blank) and apparantly all links opening in new window are ignored by uiwebview and its delegates.
I found 2 possible solutions for this:
1) Modifying the html using javascript to replace all _blank with _self for all anchor tags.
(source)
2) A more elegant solution which works for handling links which open a new window.
(source)
In my case i recreated the web page displaying form on the iphone app and changed _blank to _self.