Content Editor Web Part (CEWP) & JavaScript duplicating entries in SharePoint 2010

Recently we have migrated our SharePoint 2007 application to SharePoint 2010 and we also had manually configured few web parts in the new environment. Most of the web parts were working perfectly like sharepoint 2007 but one content editor web part which shows the weather forecast had some wired repeating behavior! 😦

Here is the weather forecast web part in the 2007 which has JavaScript to update the weather from their web site.

The JavaScript code in the Source editor:

I have created the CEWP in 2010 and paste the source code in to the editor.

and Publish the page, It is working fine no? but not really..!

Whenever I edit the page, the web part is duplicating the weather widget like this!

After spending few minutes I have found the solution in this post, actually SharePoint 2010 does not support the JavaScript directly into the source editor. So we cannot copy and paste the JavaScript to the CEWP editor instead, we have to create the scripts as a txt file (paste into a Notepad and save), upload into the SharePoint and then pointing that file as the source of CEWP.

Step 1: Open a Notepad and paste the source code

Step 2: Upload the txt file into SharePoint

Step 3: Get the url path of the txt file and paste it on the content link property of the content editor pane on the right side and click ok.

That’s all. No duplication probs any more. Happy Migrating..!

Thanks. R./




, , , , , , ,

  1. #1 by Adam Preston on June 19, 2012 - 10:09 pm

    Thanks for the reference! Great site!

  2. #2 by Methai on June 26, 2012 - 10:38 am

    this works fine! Thanks for the post~!

  3. #3 by Thiena on December 31, 2012 - 10:34 pm

    Hi IsaacThanks! Provided the two views are completely seatapre, they won’t appear together on the same page. Check in case you did a copy to create the second view and left the original as part of it. I’ve done that before.To do back | previous depends on exactly what you want. If you have a series of views that should be display in sequential order, it’s easy use back/previous to move to the previous view in the sequence you need to configure it per view. but if you mean back/previous as in mimicking the browser, that’s a lot trickier and would involve coding. Not my forte I’m afraid.Hope that helps.

Please leave a reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: