vladislav_larionov

Untitled

Aug 18th, 2023
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 0.99 KB | None | 0 0
  1. import QtQuick 2.0
  2. import Sailfish.Silica 1.0
  3. import Sailfish.WebView 1.0
  4.  
  5. Page {
  6.     id: root
  7.     allowedOrientations: Orientation.All
  8.     backNavigation: false
  9.  
  10.     PageHeader {
  11.         id: header
  12.         objectName: "pageHeader"
  13.         title: "<= Click me to add a cookie"
  14.         extraContent.children: [
  15.             IconButton {
  16.                 objectName: "addCookie"
  17.                 icon.source: "image://theme/icon-s-attach"
  18.                 anchors.verticalCenter: parent.verticalCenter
  19.  
  20.                 onClicked: {
  21.                     console.log("A cookie was added")
  22.                     webView.runJavaScript("document.cookie = \"name=test; path=/\";");
  23.                 }
  24.             }
  25.         ]
  26.     }
  27.  
  28.     WebView {
  29.         id: webView
  30.         objectName: "webView"
  31.         url: "https://ya.ru/"
  32.         anchors {
  33.             left: parent.left
  34.             top: header.bottom
  35.             bottom: parent.bottom
  36.             right: parent.right
  37.         }
  38.  
  39.     }
  40. }
Add Comment
Please, Sign In to add comment