         updateViews()
     }
 
+    override func viewWillAppear(animated: Bool) {
+        super.viewWillAppear(animated)
+        webView!.navigationDelegate = self
+        webView!.configuration.userContentController.addScriptMessageHandler(self, name: "MusicFav")
+    }
+
+    override func viewDidDisappear(animated: Bool) {
+        super.viewDidDisappear(animated)
+        webView!.navigationDelegate = nil
+        webView!.configuration.userContentController.removeScriptMessageHandlerForName("MusicFav")
+    }
+
     func loadURL(url: NSURL) {
         currentURL = url
         if let webView = self.webView {
-            self.webView!.loadRequest(NSURLRequest(URL: url))
-        }
-    }
-    
+            webView.loadRequest(NSURLRequest(URL: url))
+        }
+    }
+
     override func didReceiveMemoryWarning() {
         super.didReceiveMemoryWarning()
     }
+
     func userContentController(userContentController: WKUserContentController, didReceiveScriptMessage message: WKScriptMessage) {
         if let body = message.body as? String {
             if message.name == "MusicFav" {

    // MARK: - WKNavigationDelegate
    
    func webView(webView: WKWebView, didFailNavigation navigation: WKNavigation!, withError error: NSError) {
        print("didFailNavigation")
    }
    
    func webView(webView: WKWebView, didFinishNavigation navigation: WKNavigation!) {

                constant: 0)
            ])
        
        self.webView!.allowsBackForwardNavigationGestures = true
        playlistButton        = UIBarButtonItem(image: UIImage(named: "playlist"),
                                                style: UIBarButtonItemStyle.Plain,
