Web view is not loading for particular url - ios

I am trying to load webview for the following url http://www.topchickw.com/ but blank screen occured but same code is working for other url's
NSURL *myUrl = [NSURL URLWithString:#"http://www.topchickw.com/"];
NSURLRequest *myUrlRequest = [NSURLRequest requestWithURL:myUrl];
[self.myWebView loadRequest:myUrlRequest];
Can any one suggest me how to load webview of the particular url
Thanks in Advance

I am not an HTML expert. It seems that the URL when loaded is playing a flash video (.swf file). iOS does not support flash. Hence the blank screen.
To cross check this I try opening the URL in mobile safari browser, it did not work.
Hope that helps!

Well this url if you open manually in browser you will get blank window only. Please check the issue is not in the code.

A flash file runs when this url is loaded into browser. The issue is not with code but with the website as iOS doesnot support flash.

Related

WKWebView openurl in another application

I'm using WKWebView to show YouTube in my application.
When I load a youtube page it's sometimes open the YouTube App in my iPhone device.
This is the code I'm using:
NSURLRequest * req = [NSURLRequest requestWithURL:[NSURL URLWithString:#"https://www.youtube.com/"]];
[self.loginWebView loadRequest:req];
There is an option to detect the popup and prevent it?
I did want to post this as a comment but low rep won't let me. So, You might want to look at this topic:
Disable WKWebView for opening links to redirect to apps installed on my iPhone

UIWebView not playing embedded stream mp4 video

I am trying to play a video from a website that I load inside my UIWebView in an iOS application developed with Objective C language.
When I hit the play button, I get an error message :
The video cannot be loaded, either because the server or network failed or because the format is not supported.
The code I've written for the web view is quite simple :
NSURL *url = [NSURL URLWithString:webSite];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webBrowser loadRequest:request];
The thing is that the same video is loading fine on Safari from the same device (iPad ).
Thanks!
(1) The video is not a web site. You might need to wrap it to a web page.
(2) If the video URL is not „https://„ it will fail playing since ios9 (?). You need to enable „Arbitrary Loads“ in your App‘s Info.plist.
Advice: Check option 2 first.

PDF not opening in UIDocumentInteractionController when guided access enabled

I'm working with a UIDocumentInteractionController in iOS 7 to preview a PDF which is installed as part of the app bundle. Everything works great when I load the file using;
NSURL *url = [[NSBundle mainBundle] URLForResource:pdfName withExtension:#"pdf"];
self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:url];
self.documentInteractionController.delegate = self;
[self.documentInteractionController presentPreviewAnimated:YES];
As expected the PDF loads absolutely fine and a preview controller appears showing the document. As soon as I put the device into Guided Access mode and then try to open the PDF the controller appears as expected but the PDF does not appear, instead the controller shows the file name, format and size.
Debugging in Xcode I see the following message in the log;
Failed to load quicklookd with error : The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error 0.)
As a sanity check I tried using a QLPreviewController as well but this has yielded exactly the same result.
Does anyone have any pointers on this? Trawling through the documentation I haven't been able to turn up much yet.
This seems to be a genuine Apple bug. The best workaround I've found is to use a UIWebView instead:
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:pdfPath]];
[self.webView loadRequest:urlRequest];
Obviously if you want to present it as a modal you'll have to do some more leg work...

iOS Displaying a pdf in WebView using Google Drive Doc View

I explored many sites and obtained the following instruction that displays a pdf file in a very beautiful way.
[_pdfViewer loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString: #"http://docs.google.com/gview?embedded=true&url=http://gamersgold.com/wop-ios/uploads/eula_terms.pdf"]]];
However this URL is mainly used in Android apps:
http://docs.google.com/gview?embedded=true&url=
When using it the Google Docs caption is displayed at the bottom of the page. Would using this method cause my app to be rejected by the App Store?
Is there any alternative approach to achieve this in iOS that is provided or approved by Apple?
Using this http://docs.google.com/gview?embedded=true&url= will not get your app rejected.
Still if you have doubt, it is not necessary to use this URl. You can directly code like below and it will display the PDF in UIWebView object. You can say this is an alternative, infact, the default way to display a PDF file in UIWebView
[_pdfViewer loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString: #"http://gamersgold.com/wop-ios/uploads/eula_terms.pdf"]]];}

iOS: UIWebView full open source browser?

Does anyone know if there are any open source solutions out there that use UIWebview to build a full browser? There is something like this in Three20 when you pass a URL, but I am assuming there must be other alternatives out there.
I realize that UIWebView is a web browser, but hooking up refresh, back button, URL bar, etc will take extra time.
Suggestions?
SVWebViewController looks pretty much like what you're looking for.
I have started an open source project (MIT License) to make something as close as possible to the native MobileSafari application (on iPhone and iPad).
Here are the features so far :
Design close to Mobile Safari (iOS 4.x) native application (for both iPhone and iPad)
Bookmark support (support for folders in bookmarks not implemented yet)
Mail link support
Print web page support
Long tap handling (open or copy link) with customizable menu
Anyone wanting to contribute to this project is welcome to do it !
You can clone/fork the project here : https://github.com/sylverb/CIALBrowser
https://github.com/ghostery/banshee
EDIT the project is now maintained here: https://github.com/acatighera/banshee
It's an open source browser with tabs, bookmarks, search, etc.
UIWebView is a full browser ! To open a url in webView you do this -
NSURL *url = [NSURL URLWithString:webAddress];
NSURLRequest *req = [NSURLRequest requestWithURL:url];
[webView loadRequest:req];
You can even insert javascript into UIWebView. You could customize it to your liking.
//To customize the look & feel...
self.webView.scalesPageToFit = YES;
self.webView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
self.webView.autoresizesSubviews = YES;
//To insert Javascript
NSString *jsCommand = [NSString stringWithFormat:#"document.body.style.zoom = 0.5;"];
[self.webView stringByEvaluatingJavaScriptFromString:jsCommand];
You could do lot more. Have fun...
UPDATE: To get a back button and all, webView provides those features, back, forward etc. all those browser features. You need to code up the buttons & UI & for code you could do this -
-(IBAction)goForward:(id)sender
{
[webView goForward];
}
-(IBAction)goBack:(id)sender
{
[webView goBack];
}
-(IBAction) gotoHome:(id)sender
{
NSString *urlAddress = #"http://google.com";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
}
You can also check out KINWebBrowser, a drop in web browser module for your apps.
https://github.com/dfmuir/KINWebBrowser
Features
iOS 7 & 8 support for iPhone and iPad
Customizable UI
Portrait and landscape orientation support
Use with existing UINavigationController or present modally
Load URL from NSURL or NSString
Delegate protocol for status callbacks
Action button to allow users to copy URL, share, or open in Safari & Google Chrome
Supports subclassing
Installation with CocoaPods

Resources