Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Get url from browsers address bar



  • I want to be able to register evry website visited in chrome browser and was wondering how I could do it.

    It took me a while before finding a way to do it using win32 api but I am wondering if there might be a Qt way of doing it because I would prefer it to be cross-platform if that is possible. Also because it is being a royal pain setting it up using Win32 api as it has to run on a thread and I am imagining I will go throught the same pain on Linux.


  • Moderators

    Want to spy on your users? Not a nice thing to do.

    Anyway, from what you write the best approach seems to be to write a Chrome extension. No need for Qt or WinAPI at all.



  • @sierdzio said in Get url from browsers address bar:

    Want to spy on your users? Not a nice thing to do.

    Naah, not me. I am not kind of programmer. This serves for a feature and the user can turn it on/off.

    Anyway, from what you write the best approach seems to be to write a Chrome extension. No need for Qt or WinAPI at all.

    I read somewhere about this option and even was said that you can easily install it without the user even noticing but that's not a option for me since I am against programs that installs other things in the user computer not even as option for the user to choose unless it is REALLY, but REALLY necessary.



  • Can you read from Chrome's history file? It looks like it's a SQLite DB file. On Windows, it's in the user's AppData folder in Local/Google/Chrome/User Data/Default/History.



  • @mchinand
    OMG, that sounds even worse (for me, the user)!!



  • @mchinand That would be option if I didn't need it to be instantly, soon as the user enters a page I would like to analyse that link and then take the neccessary actions accordingly. I am not sure that trying to read a file that chrome might be writing at the same time will be good.


  • Moderators

    @hbatalha said in Get url from browsers address bar:

    @sierdzio said in Get url from browsers address bar:

    Anyway, from what you write the best approach seems to be to write a Chrome extension. No need for Qt or WinAPI at all.

    I read somewhere about this option and even was said that you can easily install it without the user even noticing but that's not a option for me since I am against programs that installs other things in the user computer not even as option for the user to choose unless it is REALLY, but REALLY necessary.

    A good browser extension is not hidden. If you user wants it, they can download it from the Chrome Web Store: https://chrome.google.com/webstore/category/extensions

    @hbatalha said in Get url from browsers address bar:

    instantly, soon as the user enters a page I would like to analyse that link and then take the neccessary actions accordingly.

    A Chrome extension can do that, as long as your user has granted it permission to read their browser URL.



  • @JKSH OK, I will have to learn how to write a Chrome extension and then get Qt to download it and the user to grant it permission though thank you!


  • Moderators

    @hbatalha said in Get url from browsers address bar:

    OK, I will have to learn how to write a Chrome extension and then get Qt to download it and the user to grant it permission though thank you!

    You're welcome.

    I'm not sure what you mean by "get Qt to download it" though -- could you please explain? A web browser extension does not involve Qt.



  • @JKSH said in Get url from browsers address bar:

    I'm not sure what you mean by "get Qt to download it" though -- could you please explain?

    I meant that when the user installs the app, the app should download the extension or asks the user to add the extension



  • @hbatalha
    I do not know, but since it's a Chrome extension there may be no download or install to do from Qt. Users may need to do this 100% through Chrome?



  • @JonB Doesn't Chrome provide any api maybe? I've had apps asking me to add extensions, others download and just asks me enable them. There sure is a way, I will need to find it.


Log in to reply