Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Allowing QtWebKit Bridge only for certain documents
Forum Updated to NodeBB v4.3 + New Features

Allowing QtWebKit Bridge only for certain documents

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 727 Views 1 Watching
  • 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
    nicky j
    wrote on last edited by
    #1

    Hello there,

    I've finally figured out how to open up part of my application to the web via a webkit bridge. Obviously this poses a severe security risk because any website out there could theoretically access parts of my program. I am trying to set up a JavaScript API that can interact with my program, and would be the only one that can call slots in my program. Is there a way to make sure that only certain websites/.js files can interact via the webkit bridge?

    Thanks!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stevenceuppens
      wrote on last edited by
      #2

      A QWebView has a urlChanged signal:

      @void urlChanged(const QUrl & url)@

      You could listen for this, and enable / diable your backend api based on the loaded url, or restrict access.

      Next you can also provide your own QNetworkAccessManager to QWebPage, where you can have full controll over what gets communicated from and to the server. I used this in the past to alter html form data before it gets send.

      Steven CEUPPENS
      Developer / Architect
      Mobile: +32 479 65 93 10

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nicky j
        wrote on last edited by
        #3

        Say I have a .js file, my qt program, and any website. If that website calls functions in the .js file, it would have access to my program, but if it calls functions in my program but not through the .js file it shouldn't work. is this possible?

        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