Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. Qt Webasssembly - Pass URL parameter to QML
Forum Update on Monday, May 27th 2025

Qt Webasssembly - Pass URL parameter to QML

Scheduled Pinned Locked Moved Solved Qt for WebAssembly
4 Posts 3 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    narayanan.krish
    wrote on last edited by
    #1

    Hello all,

    I'm developing a qt app to run on web browser using QtWebAssembly.

    Could someone tell me if it is possible to pass parameters from URL to qml ?
    For eg.

    http://localhost:8080/FusionLiteWeb.html?phonenumber=+91xxxxxxx.

    I would like to know the way to send +91xxxxxxx from the URL to qml.

    Any help is greatly appreciated.

    1 Reply Last reply
    0
    • lorn.potterL Offline
      lorn.potterL Offline
      lorn.potter
      wrote on last edited by lorn.potter
      #2

      There is a change not yet integrated that does just this.
      https://codereview.qt-project.org/c/qt/qtbase/+/248624

      Its a small change to qtloader.js so you don't even need to recompile. as most of the work is already in Emscripten. You can access the arguments the normal way QCoreApplication::arguments()

      So a url such as this:
      http://192.168.1.106:6931/wasm-args.html?arguments=yes&argument2=no

      Will receive the arguments like this:
      ("./this.program", "arguments=yes", "argument2=no")

      Freelance Software Engineer, Platform Maintainer QtWebAssembly, Maintainer QtSensors
      Author, Hands-On Mobile and Embedded Development with Qt 5 http://bit.ly/HandsOnMobileEmbedded

      1 Reply Last reply
      2
      • N Offline
        N Offline
        narayanan.krish
        wrote on last edited by
        #3

        Thank you very much. The solution worked.

        1 Reply Last reply
        0
        • SyntaXS Offline
          SyntaXS Offline
          SyntaX
          wrote on last edited by SyntaX
          #4

          This solution works fine for get parameter,
          I was wondering if this is possible for post too? Or is there another solution to this, so I don't have to show the parameter directly in the address ?

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved