Execute external Javascript


I’m trying to import and run a external JavaScript on my page generated by Vaadin

I’m importing the script within a label:

    Label javascript = new Label("<script src='scriptLocation' type=\"text/javascript\"></script>", Label.CONTENT_XHTML);

and then trying to run a function within this js file with the executeJavaScript:


I’m seeing the html result and the js file is well located and imported on browser but the execute won’t trigger the “log” function.

As a debug, using a similar html file works correctly:

Home | Mcoin
<script src='scriptLocation' type="text/javascript"></script>

within the javascript file:

function log() {
window.alert(“Hello World”);