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 Python
  4. PyQt6 - Problem with --disable-web-security
Forum Updated to NodeBB v4.3 + New Features

PyQt6 - Problem with --disable-web-security

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 3 Posters 1.1k Views 3 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.
  • A Offline
    A Offline
    Angelo54
    wrote on last edited by
    #1

    Hi, the flag "--disable-web-security" doesn't seem to work, for PyQt6, inside the QApplication() arguments. I wrote the following code:

    sys.argv.append("--disable-web-security")
    app = QApplication(sys.argv)
    

    The same code works on PyQt5. Can you help me please?
    Thank you.

    S JKSHJ 2 Replies Last reply
    0
    • A Angelo54

      Hi, the flag "--disable-web-security" doesn't seem to work, for PyQt6, inside the QApplication() arguments. I wrote the following code:

      sys.argv.append("--disable-web-security")
      app = QApplication(sys.argv)
      

      The same code works on PyQt5. Can you help me please?
      Thank you.

      S Offline
      S Offline
      StarterKit
      wrote on last edited by StarterKit
      #2

      @Angelo54, implementation of flags and features may differ a lot between releases.
      Could you please explain what you want to achieve with help of this option? i.e. why do you need it?

      1 Reply Last reply
      0
      • A Angelo54

        Hi, the flag "--disable-web-security" doesn't seem to work, for PyQt6, inside the QApplication() arguments. I wrote the following code:

        sys.argv.append("--disable-web-security")
        app = QApplication(sys.argv)
        

        The same code works on PyQt5. Can you help me please?
        Thank you.

        JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by JKSH
        #3

        Hi, and welcome!

        @Angelo54 said in PyQt6 - Problem with --disable-web-security:

        the flag "--disable-web-security" doesn't seem to work, for PyQt6

        That flag works for very old versions of Chromium (which is the core of Qt WebEngine). Newer versions of Chromium don't accept it by itself anymore: https://stackoverflow.com/a/55442160/1144539

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        A 1 Reply Last reply
        2
        • JKSHJ JKSH

          Hi, and welcome!

          @Angelo54 said in PyQt6 - Problem with --disable-web-security:

          the flag "--disable-web-security" doesn't seem to work, for PyQt6

          That flag works for very old versions of Chromium (which is the core of Qt WebEngine). Newer versions of Chromium don't accept it by itself anymore: https://stackoverflow.com/a/55442160/1144539

          A Offline
          A Offline
          Angelo54
          wrote on last edited by
          #4

          @JKSH @StarterKit

          Thank you.
          Using the flag "--disable-web-security" on PyQt5, I can access to the HTML inside the "iframe" elements, using javascript code like this:

          var iframe = document.querySelector("#iframe-id");
          var doc = iframe.contentWindow.document;
          

          I can't access to the iframe content without that flag.
          Do you have any suggestions to achieve the same goal?

          JKSHJ 1 Reply Last reply
          0
          • A Angelo54

            @JKSH @StarterKit

            Thank you.
            Using the flag "--disable-web-security" on PyQt5, I can access to the HTML inside the "iframe" elements, using javascript code like this:

            var iframe = document.querySelector("#iframe-id");
            var doc = iframe.contentWindow.document;
            

            I can't access to the iframe content without that flag.
            Do you have any suggestions to achieve the same goal?

            JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #5

            @Angelo54 said in PyQt6 - Problem with --disable-web-security:

            I can access to the HTML inside the "iframe" elements, using javascript code like this:

            var iframe = document.querySelector("#iframe-id");
            var doc = iframe.contentWindow.document;
            

            Sounds like your iframe comes from a different origin compared to your "main" page?

            I don't think that's allowed anymore in modern browsers, because it is a security flaw . See https://stackoverflow.com/questions/25098021/securityerror-blocked-a-frame-with-origin-from-accessing-a-cross-origin-frame

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            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