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, ...Adding Javascript at the end of the Body tag?Adding Javascript at the end of the Body tag?
Previous
 
Next
New Post
6/29/2012 9:46 AM
 

Hello, what is the best practise to add a javascript code at the end of the body tag? Especailly for a specific page?

 
New Post
6/29/2012 1:32 PM
 
I would suggest using jQuery and put it in the header under page settings.

<script type="text/javascript">
$('body').attr('ATTRIBUTE','VALUE');
</script>

Depending on what you are trying to do, there might be a better way but this should allow you to add something in the body tag as well as be able to use it only on a specific page.

 
New Post
6/29/2012 2:26 PM
 

For the end of the body tag (the closing tag), simply add it at the bottom of your skin.

For the end of the Head element use either our free style helper skin object:
http://stylehelper.codeplex.com/

Or use this in DNN 6.1+

<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %>

<dnn:DnnJsInclude runat="server" FilePath="jquery.cycle.min.js" PathNameAlias="SkinPath" />

More info: http://www.dotnetnuke.com/Resources/W...
 
New Post
7/24/2013 6:05 PM
 

Timo, what if your script is hosted online at a 3rd party CDN. Its my understanding that the Client Resource Manager only works for local files. In this situation, how can I dynamically inject the script before the close body tag?

 
New Post
7/25/2013 1:02 AM
 

Hi Erkan, 

I run an external 3rd party script on one of my sites for bible references(NetBibleTagger from bible.org).
To get it working I added the script code at the bottom of my skin ascx file as suggested above.

Here is an example:

Heaps of code here.........
The last part of skin file code...
Script goes here....

<%-- End of file --%>

One thing that happens is that the script does display the references until I have actually logged off.

Hope this helps
Regards
Trevor


I had one once, but the wheels fell off !!!
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Adding Javascript at the end of the Body tag?Adding Javascript at the end of the Body 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