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:
parent
af1ce6c33d
commit
8989300851
1 changed files with 10 additions and 1 deletions
|
@ -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>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue