Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

How to include only 1 Javascript file (ie modernizr.js) in <head>?


Go to End


979 Views

Avatar
vwd

Community Member, 166 Posts

26 October 2011 at 3:52pm

Hi,

I'm wondering what is the proper way to include only 1 Javascript file in the

<head>
of the document. The file is Modernizr.js and it requires inclusion in the <head> of the document.

I don't want to hardcode it into the template if I can avoid it, and I don't want to use

Requirements::set_write_js_to_body(false);
as I want the rest of the Javascript files to be placed at the end before
</body>
.

Under what circumstances would

Requirements::insertHeadTags(...)
be useful?

Thanks very much.
VWD.