Within my body tag, I have this:
<script src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAkh87y8Hjhg76ty" type="text/javascript"></script>
Is it possible to add JavaScript or jQuery in the head of the page to change the "key" parameter in the script source. I am trying to do this before the render reaches the above tag.
It is not possible to change the
srcattribute before the render reaches the tag, because modern browsers will download and parse the script as soon as it reaches a script tag (in that particular format).You can use the
deferattribute to hold off execution of the script until after the DOM has completely loaded, but this attribute is only supported in IE 4+ and Firefox 3.5+.