title: WKWebView won't open social media login popups
body: <p>I have a WKWebView in my app. Everything is running smooth except the website I show has the social media logon buttons. The problem is, they display (or try to display) a popup where you allow it to have access to your social media account. I have researched this and tried a few things, but none seem to fit. Here is what I tried:</p>
  
  <p>in viewDidLoad, I tried to enable Javascript on the init:</p>
  
  <pre><code>WKWebViewConfiguration *theConfiguration = [[WKWebViewConfiguration alloc] init];
  WKPreferences *thePreferences = [[WKPreferences alloc] init];
  thePreferences.javaScriptCanOpenWindowsAutomatically = YES;
  thePreferences.javaScriptEnabled = YES;
  theConfiguration.preferences = thePreferences;
  self.wkWeb = [[WKWebView alloc] initWithFrame:screenRect configuration:theConfiguration];
  </code></pre>
  
  <p>However, this didn't help me. Then I tried to play with the delegates and go that route. I tried playing around with the createWebViewWithConfiguration method, but that seems like overkill because I had to filter out if they are at the login URL then configure a popup and display it. And then this still wasn't working. I also come in here for the if not main frame logic, cancel the request and reload it in the main view, and that is an easy one-line fix where as this was ballooning into 20+ lines.</p>
  
  <p>This seems like a common problem, but I can't seem to find a lot of information out there. Any ideas?</p>
  
  <h3>EDIT - Addition</h3>
  
  <p>After playing around with Armands answer, I get closer. This is my createWebViewWithConfig method now, which just displays a white screen overlay. It's like I need something to tell the new popup to load the content. Also - I assume I can place this modal window in my current .m file and it doesn't need a completely new file?</p>
  
  <pre><code>NSURL *url = navigationAction.request.URL;
  if(!navigationAction.targetFrame.isMainFrame &amp;&amp; [url.absoluteString rangeOfString:@"initiate_"].location != NSNotFound) {
      //open new modal webview
      AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
      WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
      config.processPool = [appDelegate getSharedPool];
  
      self.popupLogin = [[WKWebView alloc] initWithFrame:self.wkWeb.bounds configuration:config];
      self.popupLogin.frame = CGRectMake(self.wkWeb.frame.origin.x,
                                         self.wkWeb.frame.origin.y,
                                         self.wkWeb.frame.size.width,
                                         self.wkWeb.frame.size.height);
      self.popupLogin.navigationDelegate = self;
      self.popupLogin.UIDelegate = self;
      [webView addSubview:self.popupLogin];
      [self.popupLogin loadRequest:navigationAction.request];
      return nil;
  }
  </code></pre>