Can't get WebKit to display web pageWhat is WebKit and how is it related to CSS?How can I force WebKit to redraw/repaint to propagate style changes?Getting current device language in iOS?Feasible to build your own WebKit-based UIWebView for iOS?WebKit issues with event.layerX and event.layerYJavascript / Chrome - How to copy an object from the webkit inspector as codeiPhone iOS will not display box-shadow properlyWhat are -moz- and -webkit-?Is it possible to animate the application of -webkit-tap-highlight in iOS Web?Parse push json IOS webview
What is the meaning of "you has the wind of me"?
401(k) investment after being fired. Do I own it?
Why is the return type for ftell not fpos_t?
Inadvertently nuked my disk permission structure - why?
What is "ass door"?
Do Rabbis get punished in Heaven for wrong interpretations or claims?
What is the purpose of this "red room" in Stranger Things?
What do teaching faculty do during semester breaks?
Spoken encryption
The seven story archetypes. Are they truly all of them?
For a MOSFET, does capacitive gate current only flow through to the source?
Why is a dedicated QA team member necessary?
Can I pay with HKD in Macau or Shenzhen?
What is the meaning of "a thinly disguised price"?
Film where a boy turns into a princess
Using "Kollege" as "university friend"?
Why do people say "I am broke" instead of "I am broken"?
Invert Some Switches on a Switchboard
Are gangsters hired to attack people at a train station classified as a terrorist attack?
How can I stop myself from micromanaging other PCs' actions?
Is Grandpa Irrational? Another Grandpa Mystery
Distribute large Tikz image on two A4 landscape
Is the apartment I want to rent a scam?
Determine if a triangle is equilateral, isosceles, or scalene
Can't get WebKit to display web page
What is WebKit and how is it related to CSS?How can I force WebKit to redraw/repaint to propagate style changes?Getting current device language in iOS?Feasible to build your own WebKit-based UIWebView for iOS?WebKit issues with event.layerX and event.layerYJavascript / Chrome - How to copy an object from the webkit inspector as codeiPhone iOS will not display box-shadow properlyWhat are -moz- and -webkit-?Is it possible to animate the application of -webkit-tap-highlight in iOS Web?Parse push json IOS webview
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm trying to work out how to display a web page inside my IOS app. I've tried to carefully follow what information I can find. Here is what I'm using:
@implementation FirstViewController
- (void)viewDidLoad
[super viewDidLoad];
self.productURL = @"http://google.com/";
NSURL *url = [NSURL URLWithString:self.productURL];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
_webView = [[WKWebView alloc] initWithFrame:self.view.frame];
[_webView loadRequest:request];
_webView.frame = CGRectMake(self.view.frame.origin.x+50,self.view.frame.origin.y+50, self.view.frame.size.width-100, self.view.frame.size.height-200);
printf("nReady to add the Subview");
self.view.backgroundColor = [UIColor blueColor];
[self.view addSubview:_webView];
printf("nSubView has been added");
@end
The frame is offset in the above so I could color it and see that the subview would be positioned there. The web page should appear in the subview as I understand it, but I just get a blank page.
I also added NSExceptionDomains dictionary to my Info.plist and added google.com with it having a dictionary contains NSIncludesSubdomains set to true and NSExceptionAllowsInsecureHTTPLoads set to true thinking that might be the problem, but to no avail. I've tried several urls and same thing.
How can I find out what is happening and fix it?
ios objective-c webkit mobile-webkit
add a comment |
I'm trying to work out how to display a web page inside my IOS app. I've tried to carefully follow what information I can find. Here is what I'm using:
@implementation FirstViewController
- (void)viewDidLoad
[super viewDidLoad];
self.productURL = @"http://google.com/";
NSURL *url = [NSURL URLWithString:self.productURL];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
_webView = [[WKWebView alloc] initWithFrame:self.view.frame];
[_webView loadRequest:request];
_webView.frame = CGRectMake(self.view.frame.origin.x+50,self.view.frame.origin.y+50, self.view.frame.size.width-100, self.view.frame.size.height-200);
printf("nReady to add the Subview");
self.view.backgroundColor = [UIColor blueColor];
[self.view addSubview:_webView];
printf("nSubView has been added");
@end
The frame is offset in the above so I could color it and see that the subview would be positioned there. The web page should appear in the subview as I understand it, but I just get a blank page.
I also added NSExceptionDomains dictionary to my Info.plist and added google.com with it having a dictionary contains NSIncludesSubdomains set to true and NSExceptionAllowsInsecureHTTPLoads set to true thinking that might be the problem, but to no avail. I've tried several urls and same thing.
How can I find out what is happening and fix it?
ios objective-c webkit mobile-webkit
Probably not the problem, but I'd add the view to its superview before loading the request. There's no reason for a web view to load a request if it's not installed in any view.
– Caleb
Mar 26 at 15:59
add a comment |
I'm trying to work out how to display a web page inside my IOS app. I've tried to carefully follow what information I can find. Here is what I'm using:
@implementation FirstViewController
- (void)viewDidLoad
[super viewDidLoad];
self.productURL = @"http://google.com/";
NSURL *url = [NSURL URLWithString:self.productURL];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
_webView = [[WKWebView alloc] initWithFrame:self.view.frame];
[_webView loadRequest:request];
_webView.frame = CGRectMake(self.view.frame.origin.x+50,self.view.frame.origin.y+50, self.view.frame.size.width-100, self.view.frame.size.height-200);
printf("nReady to add the Subview");
self.view.backgroundColor = [UIColor blueColor];
[self.view addSubview:_webView];
printf("nSubView has been added");
@end
The frame is offset in the above so I could color it and see that the subview would be positioned there. The web page should appear in the subview as I understand it, but I just get a blank page.
I also added NSExceptionDomains dictionary to my Info.plist and added google.com with it having a dictionary contains NSIncludesSubdomains set to true and NSExceptionAllowsInsecureHTTPLoads set to true thinking that might be the problem, but to no avail. I've tried several urls and same thing.
How can I find out what is happening and fix it?
ios objective-c webkit mobile-webkit
I'm trying to work out how to display a web page inside my IOS app. I've tried to carefully follow what information I can find. Here is what I'm using:
@implementation FirstViewController
- (void)viewDidLoad
[super viewDidLoad];
self.productURL = @"http://google.com/";
NSURL *url = [NSURL URLWithString:self.productURL];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
_webView = [[WKWebView alloc] initWithFrame:self.view.frame];
[_webView loadRequest:request];
_webView.frame = CGRectMake(self.view.frame.origin.x+50,self.view.frame.origin.y+50, self.view.frame.size.width-100, self.view.frame.size.height-200);
printf("nReady to add the Subview");
self.view.backgroundColor = [UIColor blueColor];
[self.view addSubview:_webView];
printf("nSubView has been added");
@end
The frame is offset in the above so I could color it and see that the subview would be positioned there. The web page should appear in the subview as I understand it, but I just get a blank page.
I also added NSExceptionDomains dictionary to my Info.plist and added google.com with it having a dictionary contains NSIncludesSubdomains set to true and NSExceptionAllowsInsecureHTTPLoads set to true thinking that might be the problem, but to no avail. I've tried several urls and same thing.
How can I find out what is happening and fix it?
ios objective-c webkit mobile-webkit
ios objective-c webkit mobile-webkit
asked Mar 26 at 15:46
John WootenJohn Wooten
3352 silver badges12 bronze badges
3352 silver badges12 bronze badges
Probably not the problem, but I'd add the view to its superview before loading the request. There's no reason for a web view to load a request if it's not installed in any view.
– Caleb
Mar 26 at 15:59
add a comment |
Probably not the problem, but I'd add the view to its superview before loading the request. There's no reason for a web view to load a request if it's not installed in any view.
– Caleb
Mar 26 at 15:59
Probably not the problem, but I'd add the view to its superview before loading the request. There's no reason for a web view to load a request if it's not installed in any view.
– Caleb
Mar 26 at 15:59
Probably not the problem, but I'd add the view to its superview before loading the request. There's no reason for a web view to load a request if it's not installed in any view.
– Caleb
Mar 26 at 15:59
add a comment |
2 Answers
2
active
oldest
votes
I found the problem! Apparently I needed to add the key 'App Transport Security Settings' as a dictionary to my Info.plist and add the key 'Allow Arbitrary Loads' as true to that. It now displays!
I could not find this before, but when I did and added it, it worked fine with the code just as above.
add a comment |
I know you have found the solution. But here I want to explain what is wrong with the code. The code is actually fine. The issue is you are trying to open an insecure URL http://google.com/. Any URL that starts with http:// will get blocked by iOS. Only URL that starts with https:// will be allowed without any "App Transport Security Settings".
In your case you actually has 2 options:
- Add App Transport Security Settings.
- Ensure you only calls https:// URL. You can change https://google.com and it should work without adding any App Transport
Security Settings.
As for the options that you add "Allow Arbitrary Loads" is ok for testing, but what you really need to do is add exception domains in your App Transport Security Settings. That way your app only accepts related URL only, and not ANY old URL that could've been opened by malicious url injection.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55361207%2fcant-get-webkit-to-display-web-page%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I found the problem! Apparently I needed to add the key 'App Transport Security Settings' as a dictionary to my Info.plist and add the key 'Allow Arbitrary Loads' as true to that. It now displays!
I could not find this before, but when I did and added it, it worked fine with the code just as above.
add a comment |
I found the problem! Apparently I needed to add the key 'App Transport Security Settings' as a dictionary to my Info.plist and add the key 'Allow Arbitrary Loads' as true to that. It now displays!
I could not find this before, but when I did and added it, it worked fine with the code just as above.
add a comment |
I found the problem! Apparently I needed to add the key 'App Transport Security Settings' as a dictionary to my Info.plist and add the key 'Allow Arbitrary Loads' as true to that. It now displays!
I could not find this before, but when I did and added it, it worked fine with the code just as above.
I found the problem! Apparently I needed to add the key 'App Transport Security Settings' as a dictionary to my Info.plist and add the key 'Allow Arbitrary Loads' as true to that. It now displays!
I could not find this before, but when I did and added it, it worked fine with the code just as above.
answered Mar 26 at 16:02
John WootenJohn Wooten
3352 silver badges12 bronze badges
3352 silver badges12 bronze badges
add a comment |
add a comment |
I know you have found the solution. But here I want to explain what is wrong with the code. The code is actually fine. The issue is you are trying to open an insecure URL http://google.com/. Any URL that starts with http:// will get blocked by iOS. Only URL that starts with https:// will be allowed without any "App Transport Security Settings".
In your case you actually has 2 options:
- Add App Transport Security Settings.
- Ensure you only calls https:// URL. You can change https://google.com and it should work without adding any App Transport
Security Settings.
As for the options that you add "Allow Arbitrary Loads" is ok for testing, but what you really need to do is add exception domains in your App Transport Security Settings. That way your app only accepts related URL only, and not ANY old URL that could've been opened by malicious url injection.
add a comment |
I know you have found the solution. But here I want to explain what is wrong with the code. The code is actually fine. The issue is you are trying to open an insecure URL http://google.com/. Any URL that starts with http:// will get blocked by iOS. Only URL that starts with https:// will be allowed without any "App Transport Security Settings".
In your case you actually has 2 options:
- Add App Transport Security Settings.
- Ensure you only calls https:// URL. You can change https://google.com and it should work without adding any App Transport
Security Settings.
As for the options that you add "Allow Arbitrary Loads" is ok for testing, but what you really need to do is add exception domains in your App Transport Security Settings. That way your app only accepts related URL only, and not ANY old URL that could've been opened by malicious url injection.
add a comment |
I know you have found the solution. But here I want to explain what is wrong with the code. The code is actually fine. The issue is you are trying to open an insecure URL http://google.com/. Any URL that starts with http:// will get blocked by iOS. Only URL that starts with https:// will be allowed without any "App Transport Security Settings".
In your case you actually has 2 options:
- Add App Transport Security Settings.
- Ensure you only calls https:// URL. You can change https://google.com and it should work without adding any App Transport
Security Settings.
As for the options that you add "Allow Arbitrary Loads" is ok for testing, but what you really need to do is add exception domains in your App Transport Security Settings. That way your app only accepts related URL only, and not ANY old URL that could've been opened by malicious url injection.
I know you have found the solution. But here I want to explain what is wrong with the code. The code is actually fine. The issue is you are trying to open an insecure URL http://google.com/. Any URL that starts with http:// will get blocked by iOS. Only URL that starts with https:// will be allowed without any "App Transport Security Settings".
In your case you actually has 2 options:
- Add App Transport Security Settings.
- Ensure you only calls https:// URL. You can change https://google.com and it should work without adding any App Transport
Security Settings.
As for the options that you add "Allow Arbitrary Loads" is ok for testing, but what you really need to do is add exception domains in your App Transport Security Settings. That way your app only accepts related URL only, and not ANY old URL that could've been opened by malicious url injection.
answered Mar 26 at 23:47
GeneCodeGeneCode
5,7676 gold badges35 silver badges66 bronze badges
5,7676 gold badges35 silver badges66 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55361207%2fcant-get-webkit-to-display-web-page%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Probably not the problem, but I'd add the view to its superview before loading the request. There's no reason for a web view to load a request if it's not installed in any view.
– Caleb
Mar 26 at 15:59