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. Open a Link in google chrome using QT

Open a Link in google chrome using QT

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 2.8k 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.
  • AmrCoderA Offline
    AmrCoderA Offline
    AmrCoder
    wrote on last edited by
    #1

    Hello
    iam want to open a link in google chrome browser so I use this code

    QString link = "http://www.google.com";
    QDesktopServices::openUrl(QUrl(link));
    

    but here is the problem when i use this link to open it in chrome

    chrome://settings/
    

    any link that opens a chrome setting it not open so i should open it manually, it open on an empty tab so how can I do this or automate this process if it will not in the normal way.
    Thanks in advance.

    Pablo J. RoginaP 1 Reply Last reply
    0
    • AmrCoderA AmrCoder

      Hello
      iam want to open a link in google chrome browser so I use this code

      QString link = "http://www.google.com";
      QDesktopServices::openUrl(QUrl(link));
      

      but here is the problem when i use this link to open it in chrome

      chrome://settings/
      

      any link that opens a chrome setting it not open so i should open it manually, it open on an empty tab so how can I do this or automate this process if it will not in the normal way.
      Thanks in advance.

      Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @AmrCoder said in Open a Link in google chrome using QT:

      chrome://settings/

      are you sure you can open that page with Chrome (by the way, please state your OS) from command line?

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      1
      • AmrCoderA Offline
        AmrCoderA Offline
        AmrCoder
        wrote on last edited by
        #3

        iam using Windows 10
        QT 5.10.0
        no really if I try to open this link which is setting page I can't open it using the command line like this

        chrome.exe chrome://setting/
        

        but for sure it opens other websites to use this link in google chrome I must write it manually in the search bar.

        1 Reply Last reply
        -1
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi
          That will not work on Windows as
          chrome: is NOT registered as a protocol.
          The concept is called URI Schemes
          its possible to add to registry new ones
          https://stackoverflow.com/questions/389204/how-do-i-create-my-own-url-protocol-e-g-so

          BUt that might not be optimal but depends on your actual use case :)

          Pablo J. RoginaP 1 Reply Last reply
          4
          • mrjjM mrjj

            Hi
            That will not work on Windows as
            chrome: is NOT registered as a protocol.
            The concept is called URI Schemes
            its possible to add to registry new ones
            https://stackoverflow.com/questions/389204/how-do-i-create-my-own-url-protocol-e-g-so

            BUt that might not be optimal but depends on your actual use case :)

            Pablo J. RoginaP Offline
            Pablo J. RoginaP Offline
            Pablo J. Rogina
            wrote on last edited by
            #5

            @mrjj great info about registering custom protocols under Windows. However I guess in this particular case (chrome:) even when @AmrCoder is able to add it, Chrome won't show the settings page, that's why I asked him to try on command line beforehand.

            Upvote the answer(s) that helped you solve the issue
            Use "Topic Tools" button to mark your post as Solved
            Add screenshots via postimage.org
            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

            mrjjM 1 Reply Last reply
            1
            • Pablo J. RoginaP Pablo J. Rogina

              @mrjj great info about registering custom protocols under Windows. However I guess in this particular case (chrome:) even when @AmrCoder is able to add it, Chrome won't show the settings page, that's why I asked him to try on command line beforehand.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Pablo-J.-Rogina
              I think you are right. For safety reason.
              But i never tried with chrome settings. Only an actual custom protocol. :)

              1 Reply Last reply
              1

              • Login

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