Products

Solutions

Resources

Partners

Community

About

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...Administration ...Administration ...How to insert Page Header Tags after jquery scriptHow to insert Page Header Tags after jquery script
Previous
 
Next
New Post
1/11/2010 2:47 PM
 

 I think you guys may have gotten off on a tangent here, but the original question is a good one.

DotNetNuke seems to include jQuery near the bottom of the HEAD tag.  That makes it a challenge to include other jQuery enabled javascript, unless you break with convention and add the script inside the BODY tag.

a) I think DotNetNuke should add jQuery right at the top of the HEAD tag, perhaps right after the TITLE (hint, hint).

b) In the mean time, we need to find a way to include or jQuery enabled javascript into existing DNN installations

 
New Post
1/25/2010 2:41 PM
 
I agree that it is a hindrance. I am trying to use fancybox to launch a page in a fancybox iframe and I cannot because I cant get my reference to the fancybox.js to come after the DNN jquery. I'm unable to get mine to work by putting the reference in the body either for some reason.
 
New Post
1/25/2010 4:34 PM
 

Here's the one thing I was able to make work.  

Put the code to include your custom JS in the PreRender of the Page.  This occurs after DNN has put in the link to jQuery.  For example, try something like this in the .vb code for your skin or module:

 

Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender

      Dim oScript As HtmlGenericControl

 

      oScript = New HtmlGenericControl("script")

      oScript.Attributes.Add("type", "text/javascript")

      oScript.Attributes.Add("src", "path/to/my/file.js")

      Page.Header.Controls.Add(oScript)

End Sub

 

 

 
New Post
1/25/2010 4:57 PM
 
Thanks for the response Bryan, Im not sure I know where to find the code behind files though. I'm using a skin I bought off snowcovered and a couple of different modules, but nothing I am creating myself - can I still access a .vb file?
 
New Post
1/25/2010 5:10 PM
 

No problem.  In that case just wrap the code I provided above in a <script runat="server"> tag and put it at the top of the .ascx file for the skin.

For example:

<%@ Control language="vb" CodeBehind="~/admin/Skins/skin.vb" AutoEventWireup="false" Explicit="True" Inherits="DotNetNuke.UI.Skins.Skin" %>
<%@ Register TagPrefix="dnn" TagName="SEARCH" Src="~/Admin/Skins/Search.ascx" %>

<script runat="server">
   Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
      Dim oScript As HtmlGenericControl

      oScript = New HtmlGenericControl("script")
      oScript.Attributes.Add("type", "text/javascript")
      oScript.Attributes.Add("src", "path/to/my/file.js")
      Page.Header.Controls.Add(oScript)
   End Sub
</script>

 

The rest of the skin would go here...

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...How to insert Page Header Tags after jquery scriptHow to insert Page Header Tags after jquery script


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