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

HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIaddListeneraddListener
Previous
 
Next
New Post
4/16/2008 4:42 PM
 

I am presently using the YAHOO.util.Event class to manage some onunload events.

 

var pupped = YAHOO.util.Cookie.get("pupped");
            if( pupped == null || pupped == 'undefined') {                             
                YAHOO.util.Event.addListener(window, window.onbeforeunload ? 'beforeunload' : 'unload', function(e) {           
                    var y = YAHOO.util.Event.getPageY(e);
                    var surveyCompleted = <%=SurveyCompleted%>;
                    if (surveyCompleted == false && y <= 0) {
                        var x = YAHOO.util.Event.getPageX(e);
                        if (x > 20) {    //x has coordinates in IE. we can omit the back button click.
                            showPopup();
                        }else if (x <= 0){ //x is always "0" in FF. we cannot omit the back button click.
                            showPopup();}
                    }
                });
            } else { removePopupListener(); }

 

I presently do not see a way to handle this with the DNNClientAPI, but if there is a way to try I would like to know of this.  Any advice?  YUI is simply awesome and the code works perfectly in IE and FF.  The only concern is that if I did miss a way the DNNClientAPI may do the same, we could avoid uploading more js.

 
New Post
5/6/2008 1:54 PM
 

Not sure what part of this you are struggling with, the cookie or the event handler.  Both can be done with the ClientAPI and the MSAJAX framework (which the ClientAPI will require in the next release).

MSAJAX allows you to attach events via the $addHandler global method.  The clientapi has a dnn.dom.attachEvent method, which has the following defined in its intellisense for the next release.

            /// <summary>
            /// Attatches an event to an element. - you are encouraged to use the $addHandler method instead - kept only for backwards compatibility
            /// </summary>
            /// <param name="ctl" type="Object">
            /// Control
            /// </param>
            /// <param name="type" type="String">
            /// Event name to attach
            /// </param>
            /// <param name="fHandler" type="Function">
            /// Reference to the function that will react to event
            /// </param>
            /// <returns type="Boolean" />  

Accessing cookies is straight forward.  you can either interact with the browser directly or I have helper methods in the ClientAPI.

dnn.dom.getCookie, dnn.dom.setCookie, dnn.dom.deleteCookie

 

 


 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIaddListeneraddListener


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