2

I'm trying to load the GWT Visualization Api to draw a chart like so:

Runnable onLoadCallback = new Runnable() {
        public void run() {
            LineChart chart = new LineChart(createTable(), createOptions());
            MyPage.this.add(chart);
        }
    };
VisualizationUtils.loadVisualizationApi(onLoadCallback, LineChart.PACKAGE);

This works fine running locally, but over an application server, run() is never fired. I get the following error in my browser console:

Mixed Content: The page at 'https://mysite.myorg.com/mypage' was loaded over HTTPS, but requested an insecure script 'http://www.google.com/jsapi?callback=__gwt_AjaxLoader_onLoad'. This request has been blocked; the content must be served over HTTPS.

I can't find anything in the Visualization documentation to force VisualizationUtils to load the API over HTTPS. Can anyone help me with this?

1 Answer 1

2

I use the same code (loadVisualizationApi), and it loads over https so I see no error.

This is the code used by AjaxLoader to load the packages:

private static String getProtocol() {
    if (Window.Location.getProtocol().equals("https:")) {
        return "https:";
    }
    return "http:";
}

As you can see, it picks up the protocol from the window from which a call is made, so there is no need for settings anywhere to switch to https.

Check if your gwt-visualization jar uses the same code as above. If it does, troubleshoot why the Window.Location picks up the wrong protocol.

1
  • Looks like my jar doesn't contain the same code. In version 1.0.2, the getProtocol() doesn't exist, but it's there in version 1.1.2. I installed the latest jar, and it is working correctly.
    – Alex
    Commented Nov 24, 2014 at 15:38

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.