lugreen
(Ray Lv)
June 29, 2019, 5:15am
#1
Hi,
I need to include a javascript library through url, for example from a CDN.
<jsComponent id="baiduMap"
initFunctionName="web_dashboard_widgets_project_ProjectCoord"
height="100%"
width="100%">
<dependencies>
<dependency path="vaadin://baidumap.js"/>
<dependency path="http://code.jquery.com/jquery-3.4.1.min.js"/>
</dependencies>
</jsComponent>
There external url can’t be loaded.
Did i do some thing wrong?
Thanks
gorelov
(Gleb Gorelov)
July 1, 2019, 10:38am
#3
Hi,
In fact, the JavaScriptComponent
supports external URLs.
Could you please describe in more details what problem do you face?
Regards,
Gleb
lugreen
(Ray Lv)
July 3, 2019, 9:49am
#5
Hi Gleb,
Sorry for long silence.
In a project, need include a external JS library,that is “Baidu Map ”, i included the JS library like screenshot showing:
There using a url that starts with http://,
In this form, the browser can’t load the JS library ,can’t saw any request to the library from Network panel in dev tool,but can saw the js included trhough “VAADIN:” form:
gorelov
(Gleb Gorelov)
July 3, 2019, 2:32pm
#6
As your link has no extension, JavaScriptComponent
can’t infer its type. Simply define the type
property explicitly:
<dependency path="http://api.map.baidu.com/getscript?v=2.0&ak=5962748821c8b0a35d5a4ea3a7f69007"
type="JAVASCRIPT"/>