summaryrefslogtreecommitdiff
path: root/Demos/WebView/main.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-07-06 20:01:46 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-06 20:02:30 +0200
commit32243e1df24820b8da8bcf5bc491cd812d261483 (patch)
treee4e496d26f2c7544b343065448347ec933521264 /Demos/WebView/main.cpp
parentfd65a2483492dfd50cae61b613d9bd8ed95306b3 (diff)
downloadserenity-32243e1df24820b8da8bcf5bc491cd812d261483.zip
WebContent: Plumb link clicks to the WebContentView :^)
You can now react to links being clicked via the on_link_click hook.
Diffstat (limited to 'Demos/WebView/main.cpp')
-rw-r--r--Demos/WebView/main.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Demos/WebView/main.cpp b/Demos/WebView/main.cpp
index 3d6446bb98..4fe29c725f 100644
--- a/Demos/WebView/main.cpp
+++ b/Demos/WebView/main.cpp
@@ -56,6 +56,11 @@ int main(int argc, char** argv)
statusbar.set_text("");
};
+ view.on_link_click = [&](auto& url, auto&, auto) {
+ if (url.is_valid())
+ view.load(url);
+ };
+
view.load("file:///res/html/misc/welcome.html");
return app->exec();