Facing problem in safari & chrome

Last post 02-14-2011, 1:05 AM by sanjay.joshi. 2 replies.
Sort Posts: Previous Next
  •  02-11-2011, 8:39 AM 66173

    Facing problem in safari & chrome

    Eric/Adam,
    I am facing a wierd issue in Safari, when we are trying on set the text with setHTML() method in widow.onload its not loading the text (showing me undefined). Not sure what wrong in this below is the piece of code I am using.
     
     
    window.onload = function() {
                var editor = document.getElementById('<%=cuteEditor1.ClientID %>');          
                editor.SetHTML(docContents);
            }
     
    please let me know your thoughts or solution.
     
    Thanks,
    Sanjay
  •  02-11-2011, 8:21 PM 66178 in reply to 66173

    Re: Facing problem in safari & chrome

    Hi sanjay.joshi,
     
    Get this issue because the code try to use method SetHtml before editor load completely.
     
    I suggest you set the text in  method OnInitialized of editor, like below.
     
    function CuteEditor_OnInitialized(editor)
    {
        var editor1=document.getElementById("<%= cuteEditor1.ClientID %>");
        editor1.SetHTML("text");
    }
     
    Or set a timeout
     
    1. <%@ Page Language="C#" %>  
    2.   
    3. <%@ Register Assembly="CuteEditor" Namespace="CuteEditor" TagPrefix="CE" %>  
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    5. <html xmlns="http://www.w3.org/1999/xhtml">  
    6. <head id="Head1" runat="server">  
    7.     <title>GetPlainText</title>  
    8. </head>  
    9. <body>  
    10.     <form id="form1" runat="server">  
    11.         <CE:Editor ID="cuteEditor1" runat="server">  
    12.         </CE:Editor>  
    13.       
    14.     </form>  
    15. </body>  
    16. </html>  
    17. <script>  
    18. window.onload=function()  
    19. {  
    20.     setTimeout(setText,400);  
    21. }  
    22. function setText()  
    23. {  
    24.      var editor1=document.getElementById("<%= cuteEditor1.ClientID %>");  
    25.      editor1.SetHTML("text");  
    26. }  
    27. //function CuteEditor_OnInitialized(editor)  
    28. //{  
    29. //    var editor1=document.getElementById("<%= cuteEditor1.ClientID %>");  
    30. //    editor1.SetHTML("text");  
    31. //}  
    32.   
    33. </script> 
     
    Regards,
     
    Ken
  •  02-14-2011, 1:05 AM 66202 in reply to 66178

    Re: Facing problem in safari & chrome

    Hi Ken,
     
    Thanks for the reply. Actually we are using CuteEditor_OnInitialized for IE and Mozilla but due to the issue with on initialized doesn't fires when the editor is in hidden container so, for the workaround we are using windows. onload for both of the browsers.
    I will try to use some delay as you suggested and lets see how it works.
     
    Thanks,
    Sanjay
     
View as RSS news feed in XML