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...Administration ...Administration ...Unable to run when user is a guestUnable to run when user is a guest
Previous
 
Next
New Post
6/22/2008 11:00 PM
 

I created a simple module that run a simple jquery code. If I signed in as a host or admin, it worked. However, when I logged out, it seemed that the code was not run. I modified Cache time to 0 in module settings, but nothing changed. Please tell me what to do.

Here is my code:

 

protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                if (!ClientAPI.IsClientScriptBlockRegistered(this.Page, "jquery.js"))
                {
                    ClientAPI.RegisterClientScriptBlock(this.Page, "jquery.js", "<script src='" + ResolveUrl("jquery.js") + "'></script>");
                }

                if (!ClientAPI.IsClientScriptBlockRegistered(this.Page, "jquery.lightbox-0.4.pack.js"))
                {
                    ClientAPI.RegisterClientScriptBlock(this.Page, "jquery.lightbox-0.4.pack.js", "<script src='" + ResolveUrl("jquery.lightbox-0.4.pack.js") + "'></script>");
                }

 

<table class="holder" border="1">
<tbody>
<tr>
<td id="1">One</td>
<td id="2">Two</td>
<td id="3">Three</td>
<td id="4">Four</td>
<td id="5">Five</td>
</tr>
</tbody></table>
<script type="text/javascript">
 $(document).ready(function() {
   
    //$("td:contains('Three')").text("we matched the text, then changed it."); 
    //$("td:gt(3)").text("The Last One!");
    $("#4").text("We found this using the id");
   
   $("a").click(function() {
    

 
New Post
6/23/2008 8:09 AM
 

Hi,

Does this issue persist past application restart? I'm curious to know if it still might be a cachetime issue...

When you say "code does not run" - is it just the javascript that isn't being executed? Have you checked the page source to see if the javascript files are being included? Have you tried using firebug to set a breakpoint on the javascript and see if it gets hit?

Take care,

Ian


Software Engineer
Co-Founder, dnnGallery
Stack Overflow: Ian Robinson
Twitter: @irobinson
Linked In: Ian Robinson
 
New Post
6/25/2008 11:57 PM
 

I am testing in the local. And I restarted the application many times.

I also viewed the source code and .js files were inlcuded. So the javascript wasn't excuted. It's so weird when it run well when I signed in as a host.

 
New Post
6/26/2008 3:08 AM
 

I found the solution. Change $ to jQuery and it worked.

jQuery(document).ready(function() {
   
    //$("td:contains('Three')").text("we matched the text, then changed it."); 
    //$("td:gt(3)").text("The Last One!");
   
jQuery("#4").text("We found this using the id");
   
  
jQuery("a").click(function() {

 
New Post
12/28/2008 5:13 PM
 

 I have the same problem but it doesnt work for me with your fix. Heres my function now.. works only for registered users

<script type="text/javascript" > jQuery(document).ready(function(){ jQuery(".menu2 a").append("<em></em>"); jQuery(".menu2 a").hover(function() { jQuery(this).find("em").animate({opacity: "show", top: "-75"}, "slow"); var hoverText = jQuery(this).attr("totext");  jQuery(this).find("em").text(hoverText);

}, function() { jQuery(this).find("em").animate({opacity: "hide", top: "-85"}, "fast"); }); }); </script>

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Unable to run when user is a guestUnable to run when user is a guest


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