From 05f28088499fdc0105bb17cee9345a3483aa24f2 Mon Sep 17 00:00:00 2001 From: Alexandre Van de Sande Date: Mon, 16 Feb 2015 11:17:31 +0100 Subject: [PATCH] Add http when not present on browser --- cmd/mist/assets/qml/views/browser.qml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/mist/assets/qml/views/browser.qml b/cmd/mist/assets/qml/views/browser.qml index ff3ff0f7fe..a6f4e3d925 100644 --- a/cmd/mist/assets/qml/views/browser.qml +++ b/cmd/mist/assets/qml/views/browser.qml @@ -238,7 +238,12 @@ Rectangle { z: 20 activeFocusOnPress: true Keys.onReturnPressed: { - webview.url = this.text; + // if there's no http, add it. + var url = this.text, + matches = url.match(/^([a-z]*\:\/\/)?([^\/.]+)(:?\/)(.*|$)/i), + requestedProtocol = (matches && matches[1] != "undefined")? "" : "http://"; + + webview.url = requestedProtocol + url; } }