I faced with this problem and resolved by adding google maps js library dynamically to dom content with callback google maps parameter:
Example in this thread:
https://vaadin.com/forum#!/thread/2971952/2975500
I tried your solution. The problem is that I am not using pure Javascript. I am integrating a GWT widget. I tried to call directly to the javascript code that you suggest in the constructor of my children class
This is exactly what the error message says: Google has set an X-Frame-Options header that instructs compliant browsers to refuse to load the script in a cross-origin iframe. It seems this is only a problem if the Vaadin application is loaded inside an iframe, and in that case I don’t know of any good workaround as that problem is not in any way related to Vaadin or the @JavaScript annotation.
The reason for this problem is that the script uses document.write to inject another script tag that loads the rest of the library. document.write does however not work after the page has been loaded; older browsers just produce a blank page whereas newer browsers ignore the call and just display a warning in the javascript console. The easiest way of working around this problem is probably to include the script in the initial HTML. You can use something similar to
https://vaadin.com/wiki/-/wiki/Main/Customizing%20the%20startup%20page%20in%20an%20application for adding a suitable script tag to the HTML that loads the Vaadin application.
Very nice solution,but after reading everything u have given and change some links like the package name,I still get this error:
Could not initialize JavaScriptConnector because no JavaScript init function was found. Make sure one of these functions are defined:
de_upb_cik_rescueLab_vaadin_GMap
com_vaadin_ui_AbstractJavaScriptComponent
com_vaadin_ui_AbstractComponent
com_vaadin_server_AbstractClientConnector
The javascript file that contains the de_upb_cik_rescueLab_vaadin_GMap function is not loaded. You can use the the Net panel in e.g. Firebug to check for this.
The javascript file is loaded, but it contains some syntax error that causes the browser to ignore it. You can use the the Console panel in e.g. Firebug to check for this.
I came across this post and it came in very useful for integrating Gmaps with Vaadin 7. But I noticed that the shared state communication doesn’t actually work; The on click method gets called normally on the server but when setting the state from the server side, nothing reaches the browser. I was trying to find out what was actually happening and finally, when I printed out the GMap object instances, I amazingly noticed that there were two of them! One which received the onClick method messages (a GMap$1 inner class instance) and my normally initialized instance for adding to the layout (a GMap instance),
Can anyone explain this? My GMap consturctor is called only once but there are two objects (outer and inner), so the second one must have been created by Vaadin. How can I overcome this?