I see gmap just after update page. If I don't update page I get error in chrome console
Uncaught ReferenceError: google is not defined index.xhtml:1
Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
<h:body>
<ui:composition template="/WEB-INF/template/layout_template.xhtml">
<ui:define name="windowTitle">
Admin Panel
</ui:define>
<ui:define name="content">
<h:form>
<div class="panel panel-default">
<div class="panel-heading">Map</div>
<div class="panel-body">
<p:gmap type="roadmap" center="50.00, 28.00" zoom="8" style="width: 1000px; height: 400px;"/>
</div>
</div>
</h:form>
<!--<h:outputScript name="app/google-map-loader.js" library="js" target="head"/>-->
<script src="https://maps.googleapis.com/maps/api/js?sensor=false" type="text/javascript">
</script>
</ui:define>
</ui:composition>
</h:body>
</html>
My footer template
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
>
<body>
<ui:composition>
<div class="bottom-nav footer"> 2013 © by Me</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<h:outputScript name="lib/bootstrap.min.js" library="js" target="body"/>
<h:outputScript name="app/smooth-sliding-menu.js" library="js" target="body"/>
</ui:composition>
</body>
</html>
I read in doc
But I don't want put gmap script in head of main template. Is it posiible to make it work without redirect. And is it possible to add script in head of child template