title: Back button not working for my manually loaded UIWebView for external website
body: <p><strong>Technologies</strong>: Swift, iOS8.1.3, XCode 6, Maverick</p>
  
  <p>I've added a "rewind" back button to my UIWebview via the main.storyboard and connected it here on my view with a backButton func:</p>
  
  <pre><code>class ViewController: UIViewController, UIWebViewDelegate  {
    @IBOutlet weak var webView: UIWebView! 
    var detailItem: NSURL?
    var grabData = false
  
   override func viewDidLoad() {
      super.viewDidLoad()
      webView.delegate = self
      self.navigationController?.toolbarHidden = false;
   }
  
   @IBAction func backButton(sender: AnyObject) {
      self.webView.goBack()
    }
  
   override func viewDidAppear(animated: Bool) {
      super.viewDidAppear(animated)
      if let url = self.detailItem {
          webView.loadRequest(NSURLRequest(URL: url))
      }
  }
  
  func webView(webView: UIWebView, shouldStartLoadWithRequest request:  
      NSURLRequest, navigationType: UIWebViewNavigationType) -&gt; Bool {
      if grabData {
          grabData = false
          return true
      } else {
          grabData = true
          manuallyLoadPage(request)
          return false
      }
  }
  
  func manuallyLoadPage(request: NSURLRequest) {
      let session = NSURLSession.sharedSession()
      let task = session.dataTaskWithRequest(request) {
      (data, response, error) invar html = NSString(data: data, encoding: NSUTF8StringEncoding) as String
          html = html.stringByReplacingOccurrencesOfString("&lt;/head&gt;", withString: "&lt;styles&gt;&lt;link rel='stylesheet' type='text/css' href='link-to-styles.css' media='all'&gt;&lt;/styles&gt;&lt;/head&gt;", options: NSStringCompareOptions.CaseInsensitiveSearch, range: nil)
          self.webView.loadHTMLString(html, baseURL: response.URL!)
      }
      task.resume()
  }
  </code></pre>
  
  <p>My back button doesn't do anything when clicked and I want it to show the previous webpage. I think it has something to do with how I am intercepting the session and manually loading the WebView. Maybe it doesn't know what the original base url is? Something else?</p>