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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Adding Javascript files to the head tagAdding Javascript files to the head tag
Previous
 
Next
New Post
11/12/2009 2:08 PM
 

First off - sorry if this (noob) question is in the wrong Forum - it seemed the best fit for me...

I have spent some time surfing on this matter - and am not seeing anything exactly straight forward on how to handle this...  I'm new to DNN - but have been programming for several years.  I don't see any good way to add a javascript FILE to the head tag of the page.  These files must be included to the head tag - and there is far too much code to reinvent the wheel here...  I am taking code that has been in aspx land for quite some time and converting to use in DNN.

I wound up making some (non best-practice) modifications to the core default page in order to roll out a demo...  Well, we need to go live with this fairly soon, and I need to find a way to handle this...correctly.

Bare in mind that I haven't done any skinning here...  The skinning protion is being handeled by a different department - and I am just developing modules for certain uses.  That having been said, must the javascript files be added in the skin in order to reside inside the head tags?  If so, does anyone know of any good tutrials that covers this?

Thanks in advance for any help you can give!!!

 
New Post
11/14/2009 10:36 AM
 

 You could either include the reference to the JavaScript in the Skin or in the Module.

Either way, just do something like this:

<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
    oScript.TagName = "script"
    oScript.Attributes.Add("type", "text/javascript")
    oScript.Attributes.Add("src", "/Portals/0/js/home.js")
    Page.Header.Controls.Add(oScript)
  End Sub
</script>
 
New Post
11/18/2009 10:34 AM
 

I'll give it a shot - Thanks for the reply!

 
New Post
11/18/2009 10:54 AM
 

Simple solution...works great.

Thanks again!

 
New Post
12/13/2009 11:48 PM
 

I inserted this code into my skin's aspx file, which worked fine.  However, due to a change, I now need to remove the scripts added by this code.  I've removed all of the code from my skin, but the javascript is still showing up in the rendered page.  I've cleared cache, tried a completely different browser, restarted the web server, etc. but I can't get rid of the scripts.  Does this code cause it to be written to another file somewhere?  How do I undo this change?  Thanks!

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Adding Javascript files to the head tagAdding Javascript files to the head tag


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