Add http when not present on browser

parent 7aef0fed
......@@ -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;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment