what's the equivalent of shouldStartLoadWithRequest in SFSafariViewController? - wkwebview

is there a way to hook into SFSafariViewController
url loading ?
similar to in UIWebViewDelegate protocol:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:
That OR get autofill for usernames/passwords to work
in WKWebView
thanks

Related

iFrameResizer plugin not resizing iframe

I have implemented the iFrameResizer plugin here with the following settings:
$('#iframeResizer').iFrameResize({
log : true,
scrolling : true,
enablePublicMethods : true, // Enable methods within iFrame hosted page
heightCalculationMethod : 'lowestElement'
});
and the iframeSizer.contentWindow.min.js has been added to the iframe content window - I can see that the scroll bars are working which tells me the iFrame Resizer plugin has been implemented correctly - but the height is not resizing correctly??
Here are the console results
I thought perhaps maybe the problem could be from the iFrame content being hosted on a secure server????
If anybody is able to offer some advice or suggestions I'd really appreciate it.
You need to set the checkOrigin option.
https://github.com/davidjbradshaw/iframe-resizer/blob/master/docs/parent_page/options.md#checkorigin

UIWebView not loading data sometime in iOS 9

UIWebView not loading (mobile web page) sometime in iOS 9. I already used ATS bypass using NSAllowsArbitraryLoads.The issues not happening always and works well in iOS 7 and 8.
The delegate method webViewDidStartLoad invoked but webViewDidFinishLoad and didFailLoadWithError is not getting called at all.
Found the solution.All you need to do is remove UIWebView in iOS 9 and use WKWebView.My webpage had some third party calls to twitter,instagram etc which is https.Also I was getting Auth challenge in my webpage..! (Even I disabled the ATS).I found this by using WKWebView,which has the delegate to handle auth challenge.
Set the below delegate to get the auth challenge and handle it.
- (void)webView:(WKWebView *)webView
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
{
SecTrustRef serverTrust = challenge.protectionSpace.serverTrust;
CFDataRef exceptions = SecTrustCopyExceptions(serverTrust);
SecTrustSetExceptions(serverTrust, exceptions);
CFRelease(exceptions);
completionHandler(NSURLSessionAuthChallengeUseCredential,
[NSURLCredential credentialForTrust:serverTrust]);
}

Redirected URL in UIWebview not loading images

I have a problem where I load a URL in UIWebView. The URL redirects to a different location.
I handle this redirect with the following code:
- (NSURLRequest *)connection:(NSURLConnection *)inConnection willSendRequest:(NSURLRequest *)inRequest redirectResponse:(NSURLResponse *)inResponse {
if(inResponse) {
NSMutableURLRequest *req = [[inConnection originalRequest] mutableCopy];
[req setURL:[inRequest URL]];
return req;
}
return inRequest;
}
However, when the page loads, I get 404 on all the images. I can load the URL in Safari without any problems. This is happening on iOS6.1 and iOS7
I'm completely stumped as to what to do.
Unfortunately, I don't have access to the server, so I have to handle everything in my app.
Thanks for any advice.
Ah okay,
So what seems to have been happening, is that the my custom auth protocol was handling the initial request, then when the redirect request came in, a second caching protocol was intercepting the request for the images and breaking the redirect.
In the authprotocol, in the startLoading method I do the following:
[NSURLProtocol setProperty:#YES forKey:#"AuthSet" inRequest:newRequest];
So in the caching protocol's canInitWithRequest method I do the following:
if([NSURLProtocol propertyForKey:#"AuthSet" inRequest:request] != nil)
return NO;
Since, when we are caching, we have no need to follow redirects. So basically if the Auth protocol grabs the request, the caching protocol should not respond to it.
Will update after some testing to see if there are any other side effects.

UIWebView not loading mobile twitter (iPad)

I try to load Twitter into my UIWebView Using loadHTMLString (after loading the DOM using an NSURLRequest), now the string I have contains the correct HTML.
It loads the twitter page, but then I only get the black bar showing a progress circle, is anyone familiar with this problem and knows how to solve it?
Why do you download the html first and try loading the UIWebView with loadHTMLString after?
I think you create some issue with the ajax 'magic' because you don't run the html from the same domain as your ajax calls. And it seems like cross site scripting.
I think you can better use something like this and really load in the twitter homepage.
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Request Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[webView loadRequest:requestObj];

Symfony2 and Uploadify : security token is not kept

I'm trying to make Symfony2 and Uploadify working together in a secured area.
(Uploadify is a flash/javascript component used to upload multiple files)
My uploadify component is working fine when the back-end script route is out of the secure area, but when in this area, I get a 302 HTTP error.
The log message is :
security.INFO: Authentication exception occurred; redirecting to authentication entry point (A Token was not found in the SecurityContext.)
While searching for an answer, I found that passing the PHPSESSID to the back-end script as a post parameter should work on "non-framework php" but with the Symfony Security Component, it seems that this script is not even reached.
Does anyone know if there is a way to send that token to the back-end script while keeping this script in the secure area ?
After having a read around the Symfony website, it's possible that this solution may work (haven't tested it). In your security.yml file, change your access_contol config option to something like this...
access_control:
- { path: ^/path/to/flash_component, roles: IS_AUTHENTICATED_ANONYMOUSLY }
Where /path/to/flash_component is the URL you are uploading to in Uploadify. Let me know if that works.

Resources