1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 06:18:12 +00:00

Browser: Assume http:// when no protocol is provided in the location bar (#2142)

This commit is contained in:
Maciej Sobaczewski 2020-05-07 11:57:53 +02:00 committed by GitHub
parent af1ce6c33d
commit 8989300851
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,6 +30,7 @@
#include "History.h"
#include "InspectorWidget.h"
#include "WindowActions.h"
#include <AK/StringBuilder.h>
#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h>
@ -98,7 +99,15 @@ Tab::Tab()
m_location_box = toolbar.add<GUI::TextBox>();
m_location_box->on_return_pressed = [this] {
m_html_widget->load(m_location_box->text());
String location = m_location_box->text();
if (!location.starts_with("file://") && !location.starts_with("http://") && !location.starts_with("https://")) {
StringBuilder builder;
builder.append("http://");
builder.append(location);
location = builder.build();
}
m_html_widget->load(location);
};
m_bookmark_button = toolbar.add<GUI::Button>();