Fix bug where urls with scheme did not load
This commit is contained in:
@@ -244,14 +244,16 @@ class BrowserViewController: UIViewController, WKNavigationDelegate,
|
||||
// MARK: UITextField Delegate
|
||||
|
||||
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
||||
if let text = textField.text, let url = URL(string: text) {
|
||||
if let text = textField.text, var url = URL(string: text) {
|
||||
if url.scheme == nil {
|
||||
let urlString = "https://\(text)"
|
||||
if let url = URL(string: urlString) {
|
||||
if let fixedURL = URL(string: urlString) {
|
||||
url = fixedURL
|
||||
}
|
||||
}
|
||||
|
||||
tab.beginLoadingURL(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
textField.resignFirstResponder()
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user