Important: Please read the Qt Code of Conduct -

Google url shortener is not working on mobile qml

  • Hello,

    I would want to use google url shortener due to hide actual link from people. I am trying build one media player for android but google url shortener is not working. If i gave actual link there is no problem.

    Also i tried with stocqt which is coming with qtcreater also it was not working. In stocqt there is link and i converted it shortener link after i saw that it was not working.

    Actually shortener url is working in android as well.

    Any one knows how to achieve that problem how can we use google url shortener .


  • Hi All,
    Okay i found out solution by myself, the following code can able to get actual link.

    Idea is you need parse from response where is location.

    @function httpGet(theUrl)
    var locationUrl;
    var http = new XMLHttpRequest() ("GET", theUrl, true); // async
    http.send (null);

                        http.onreadystatechange = function() // Call a function when the state changes.
                            if (http.readyState == 4)
                                if (http.status == 200)
                                    locationURL = http.getResponseHeader("location")
                                    //console.log("headers: " + locationUrl + " locationUrl: " + locationUrl)
                                } else
                                    console.log("error: " + http.status)
                        return locationUrl;

Log in to reply