I have a DNN module that I wrote that includes the css/js for the jquery fancybox plugin like so:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="View.ascx.cs" Inherits="DotNetNuke.Modules.WebPortfolio.View" %>
<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %>
<dnn:DnnCssInclude runat="server" priority="10" FilePath="DesktopModules/WebPortfolio/Scripts/Fancybox/jquery.fancybox.css" />
<dnn:DnnJsInclude runat="server" priority="10" FilePath="DesktopModules/WebPortfolio/Scripts/Fancybox/jquery.fancybox.pack.js" />
When I'm in Edit mode, everything is fine and dandy, but when I switch to View mode, the css and js are not included. This seems fairly simple, so I guess I'm missing something, but what? Why aren't the scripts loading in View mode?
DNN version is 6.2.4
Edit: I've been fighting with this all last night and this morning. The script loads every time in Edit mode, but when in View mode or logged out, it loads maybe once or twice, then fails to load. Interestingly, I added a server side timestamp to the module's view control and disabled all caching (browser, DNN host settings) and the file is still being cached. This occurs on both my local machine (IIS Express) and our staging server (IIS 7.5).
If I bounce the web server and clear the Portals/0/Cache directory, the script occasionally loads the first time, but fails after that. I've finally resorted to a client side check which loads the script dynamically if necessary, but that circumvents the goodness of the client resource management API, so I'd really like to figure out a proper solution.
This sounds like an issue that I just logged (DNN-20363), where resources registered with the Client Resource Management Framework aren't included when the module is cached. I was running into this when the module had module caching on. Does your module have a default cache time set in its module definition? You might try turning that off and then adding a new instance (to make sure that the caching setting itself isn't getting cached).