0

I have JavaScript that manipulates the DOM for some of my pages. The HTML changes and stuff happens. But it would be nice, if there was a feature in SharePoint that allows us to put in HTML that we know that we can always go back to (that was the original HTML). This way when I got back to edit a page that has JavaScript manipulations, I won't see the manipulations, instead I will see the original HTML that I put in. Does that make sense?

Is this possible with SP2013 when working with publishing pages in edit mode?

Thanks

  • if the DOM manipulations are automatic on page load, then no there isn't really a way to reset it. If you are triggering the manipulations via a button or something, then refreshing the page would get you back to the original state so long as you didn't save the page. Not really sure though what you are trying to do though. – Eric Alexander Jul 15 '14 at 16:15
  • I think I found way....create a Reusable content (HTML), and then insert that content into the page I am editing. Now every time I go back to editing that page, I can depend on that reusable content not being distorted. And even if it is, simply insert it again onto the page while editing. – klewis Jul 15 '14 at 16:19
  • That also works :-) – John Chapman Jul 15 '14 at 16:21
2

When entering HTML content into a SharePoint page or web part, it will always modify the markup using SharePoint's black box. There is, however, a workaround that might work for you:

1) Use a Content Editor web part (you can insert one into regular page content or a web part zone)

2) Put all of your markup in an HTML or TXT file stored in a document library on the site

3) In the web part settings for the Content Editor web part, set the URL to that HTML or TXT document as the source.

This will put your unadulterated content on the page and you can just edit the HTML or TXT file to update the content.

  • 1
    Thank you John, awesome plan. I have a folder in Style Library called "call-blocks" and I did just what you are talking about while working in SharePoint 2010. Each .htm file in my call-blocks folder represented HTML code that I wanted to preserve as original. I would then call that file onto a live SharePoint page using jQuery's Ajax methods and properties. I may just continue to rely on that technique. – klewis Jul 15 '14 at 16:24
  • I love your approach john, I will take this, as well as the resubale content approach to move forward. – klewis Jul 17 '14 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.