1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:07:45 +00:00

Ladybird: Add a protocol to the URL, when one is not set

When a http(s):// is not written by the user - lets manually add one.
This commit is contained in:
Diego Iastrubni 2022-07-14 18:32:51 +03:00 committed by Andrew Kaster
parent 700c709c00
commit 2905bda0f2
2 changed files with 4 additions and 2 deletions

View file

@ -73,8 +73,10 @@ Tab::Tab(QMainWindow* window)
QObject::connect(focus_location_edit_action, &QAction::triggered, m_location_edit, &QLineEdit::selectAll);
}
void Tab::navigate(QString const& url)
void Tab::navigate(QString url)
{
if (!url.startsWith("http://", Qt::CaseInsensitive) && !url.startsWith("https://", Qt::CaseInsensitive))
url = "http://" + url;
view().load(url.toUtf8().data());
}

View file

@ -23,7 +23,7 @@ public:
WebView& view() { return *m_view; }
void navigate(QString const&);
void navigate(QString);
void debug_request(String const& request, String const& argument);