开发者

My javascript works great locally but crashes when it is on server, why?

开发者 https://www.devze.com 2023-02-06 21:51 出处:网络
Hy, In my aplication I use Cute Editor for editing some html files. Everything works great locally, but when I publish my aplication on a server it doesn\'t recognize the javascript that loads this

Hy,

In my aplication I use Cute Editor for editing some html files.

Everything works great locally, but when I publish my aplication on a server it doesn't recognize the javascript that loads this editor, and if I clear the cache from my browser and then refresh the page it works.

This is the code for integrating the editor to my aspx page:

 <CE:Editor ID="Editor1" runat="server" Height="730px" Width="1100px" CssClass="CuteCSS"
   OnPostBackCommand="SaveClick" EditCompleteDocument="true" EnableStripStyleTagsCodeInjection="false">
 </CE:Editor>
开发者_如何学运维

Does anyone have any idea why is this thing happening?


I have implemented Cute Editor in my .net application and working fine on sever also with the following settings:

<CE:Editor ID="Editor1" runat="server" Height="380px" Width="100%" UseFontTags="True"
DisableAutoFormatting="true" EditorOnPaste="default" >
    <TextAreaStyle Height="100%" BorderWidth="4px" BorderStyle="Solid" BorderColor="#DDDDDD"
        Width="100%" BackColor="White"></TextAreaStyle>
</CE:Editor>

<script language="JavaScript" type="text/javascript">
    function CuteEditor_OnCommand(editor,command,ui,value)
    {   
        if(command=='PostBack' && value=='Save')
        {
            if(SaveData() == false)
                return true;
             else
                return false;   
        }
    }
</script>

try with the given code it might be helpful for you and also notice that you should have all the necessary Cute Editor dll and files in your application.

Now for caching write given code on page load:

protected void Page_Load(object sender, EventArgs e)
{
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    Response.Cache.SetExpires(DateTime.Now);
    Response.Cache.SetNoServerCaching();
    Response.Cache.SetNoStore();
}


The above code snippet is server side code. Is this appearing in the HTML delivered to your page as well? If so this will be what is causing your problem.

Also I'd suggest checking that your config files are not different on dev and live (and that you have installed appropriate Possible reasons could be differences in config files between your live and dev environment. I'd certainly check that out.

Also you might want to confirm that your server has the right CuteEditor files installed though I would expect some other error if you were missing dlls.

If none of the above is relevant then it might be worth checking that the HTML delivered to the client has sensible valid script to add in the right javsascript files. Load function not being defined sounds like your script file not being loaded which may be that there is no script tag to load it or that it is pointing at an incorrect location (which is valid on your local but not on your dev machine).

I hope some of the above suggestions help.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号