Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...How to add javascript in the head tags of dnn 4.9 How to add javascript in the head tags of dnn 4.9
Previous
 
Next
New Post
1/10/2009 12:28 PM
 

I want to add a bit of javascript code to dnn 4.9.0 site in the head tags and then call that javascript from the body onload event. Is there a way to do this ?

 

 
New Post
2/3/2010 6:14 PM
 

 Is there a way to do this that is similar to this method of adding a CSS File?

            CType(Me.Page, CDefault).AddStyleSheet(ID, CSSFilePath, ShowOnTop)

I am using DNN 5.2

 
New Post
2/4/2010 1:12 AM
 

You can insert your Javascript in the "Page Header tags" of the Page settings. or you can insert it also in the skin file which is applied to that  Page.


Amrish Sharma, MCP
 
New Post
2/4/2010 7:26 PM
 

 The problem with inserting in the "Page Header Tags" is two-fold. 1) You can't control the order of the scripts and 2) It is still page specific, not skin specific.

The problem with inserting directly in the skin is you still can't control the order of the scripts.

What I like about the preceding stylesheet function is you can control where the stylesheet is inserted. (Top or bottom.) The order that Javascripts are inserted is actually very important with some jQuery scripts.

 
New Post
6/11/2010 9:57 AM
 
I don't know if you're still looking for a solution to this problem or not...but a solution that has worked well for us is to add a code-behind file to your skin (alternatively, you can do this inline in the skin.ascx file as well) and load your javascripts using the Asp.NET RegisterClientScriptBlock method, which will inject your script (or script reference) into the "Head" tags of your page. More information here: http://msdn.microsoft.com/en-us/library/aa478975.aspx
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...How to add javascript in the head tags of dnn 4.9 How to add javascript in the head tags of dnn 4.9


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out