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.0k 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 23 Dec 2022, 12:08 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 J 2 Replies Last reply 26 Dec 2022, 08:17
    0
    • A Angelo54
      23 Dec 2022, 12:08

      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 26 Dec 2022, 08:17 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
        23 Dec 2022, 12:08

        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.

        J Offline
        J Offline
        JKSH
        Moderators
        wrote on 27 Dec 2022, 01:26 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 29 Dec 2022, 16:03
        2
        • J JKSH
          27 Dec 2022, 01:26

          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 29 Dec 2022, 16:03 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?

          J 1 Reply Last reply 30 Dec 2022, 02:18
          0
          • A Angelo54
            29 Dec 2022, 16:03

            @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?

            J Offline
            J Offline
            JKSH
            Moderators
            wrote on 30 Dec 2022, 02:18 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

            2/5

            26 Dec 2022, 08:17

            • Login

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