Skip to content

Commit

Permalink
Allow bookmarks on pages that have no title
Browse files Browse the repository at this point in the history
  • Loading branch information
daphtdazz committed Apr 8, 2022
1 parent 31d407e commit 689978b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion BasicBrowser/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ class ViewController: UIViewController, UITextFieldDelegate, WKNavigationDelegat
@IBAction func addBookmark() {
guard
let title = self.webView.title,
!title.isEmpty,
let url = self.webView.url,
url.absoluteString != "about:blank"
else {
NSLog("Cannot bookmark \(self.webView.title ?? "<no title>") \(self.webView.url?.absoluteString ?? "<no url>")")
let uac = UIAlertController(title: "Unable to bookmark", message: "This page cannot be bookmarked as it has an invalid title or URL, or was a failed navigation", preferredStyle: .alert)
uac.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(uac, animated: true, completion: nil)
Expand Down

0 comments on commit 689978b

Please sign in to comment.