You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by mlabs <ml...@gmail.com> on 2012/08/07 04:54:52 UTC

contributing external javascript resources

I have a page that renders a googleapi map in a wicket panel. Works great. I
thought I would optimize things a bit by having the panel contribute the
googleapi javascript reference to the header, instead of having it
permanently referenced in the page header irrespective of whether the map
panel is visible or not... so I override renderHead() in my panel like so:

public void renderHead(IHeaderResponse response){
   
response.renderJavascriptReference(""http://maps.googleapis.com/maps/api/js?sensor=false",
"gmap-api");
}

however, this doesn't work.. and in the browser javascript debugger I see
this:
Warning: A call to document.write() from an asynchronously-loaded external
script was ignored.
Source File: http://maps.googleapis.com/maps/api/js?sensor=false

Q:what is the correct way to contribute external javascript references to
the header?
TIA 





--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/contributing-external-javascript-resources-tp4651029.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: contributing external javascript resources

Posted by "Phillips, David" <Da...@usaa.com>.
That's the correct way to reference external resources (prior to Wicket 6). Wicket will just include a script tag in your HeaderResponse container. 

This looks like it might be an issue related to the way you initialize the google maps API. This stackoverflow comment suggests a possible solution (http://stackoverflow.com/questions/7811985/warning-a-call-to-document-write-from-an-asynchronously-loaded-external-scrip#comment13842467_7812160).

Thanks,
-David Phillips

-----Original Message-----
From: mlabs [mailto:mlabs.dev@gmail.com] 
Sent: Monday, August 06, 2012 9:55 PM
To: users@wicket.apache.org
Subject: contributing external javascript resources

I have a page that renders a googleapi map in a wicket panel. Works great. I thought I would optimize things a bit by having the panel contribute the googleapi javascript reference to the header, instead of having it permanently referenced in the page header irrespective of whether the map panel is visible or not... so I override renderHead() in my panel like so:

public void renderHead(IHeaderResponse response){
   
response.renderJavascriptReference(""http://maps.googleapis.com/maps/api/js?sensor=false",
"gmap-api");
}

however, this doesn't work.. and in the browser javascript debugger I see
this:
Warning: A call to document.write() from an asynchronously-loaded external script was ignored.
Source File: http://maps.googleapis.com/maps/api/js?sensor=false

Q:what is the correct way to contribute external javascript references to the header?
TIA 





--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/contributing-external-javascript-resources-tp4651029.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org