Adding default protocol to URLs typed without one
This commit is contained in:
parent
184d9697d8
commit
5abb9e13db
@ -3,6 +3,8 @@
|
||||
home = https://example.com
|
||||
# User agent, used to identify your browser to a website
|
||||
useragent = BirdyNet/$VER ($OS)
|
||||
# Which protocol to use when none is given in the address bar
|
||||
defaultProtocol = https
|
||||
|
||||
[accessibility]
|
||||
# Which background color (CSS color) should be chosen for websites? "default" for system's default. "white" is recommended for compatibility.
|
||||
|
@ -164,6 +164,12 @@ class browserWindow(QMainWindow):
|
||||
self.cTaskLock.acquire()
|
||||
self.cDownloadId += 1
|
||||
url = self.cUrlBar.text().replace(" ","%20") # dirty
|
||||
urlParsed = parseUrl(url)
|
||||
if urlParsed["protocol"] == "":
|
||||
while len(url) > 0 and url[0] == "/":
|
||||
url = url[1:]
|
||||
url = config["default"]["defaultProtocol"]+ "://" +url
|
||||
self.cUrlBar.setText(url)
|
||||
threading.Thread(target=downloadPage, args=(self,self.cDownloadId,url,[("User-Agent",self.cUserAgent)])).start()
|
||||
self.cTaskLock.release()
|
||||
self.cDoc.setFocus()
|
||||
|
Loading…
Reference in New Issue
Block a user