1

Which way is the preferred when you want to built a Single Page Application within SharePoint. I mean i can put my .js into some Library and my HTML to a Content Editor WebPart, but my question is if it is possible to use a complete .html page for this purpose instead of using the Content Editor Webpart.

Edit

There seems no way to "grab" the page without using SPD, edit it locally and upload it back through UI?? The only way is to use a CEWP inside this newely created page out of SharePoint UI -> by using Add a Page?!

  • Regardless of how you use the page, you'll have to edit it in either SPD or download a copy and re-upload it. That's not specific to a CEWP, or even to SharePoint. To make changes to an html page you have to modify it in an editor, or download it and modify in a local editor and reupload. You only have to add a new page with a CEWP one time, point the CEWP to wherever your html file lives, and from that point forward, the content will update any time you change the html. You haven't really explained why that's a problem for you. – Erin L Jul 7 '16 at 17:20
  • Its not a problem i havent done this ever before... – BOG Jul 7 '16 at 18:17
  • Okay. Then yes, follow what Amal is explaining in his comments. – Erin L Jul 7 '16 at 18:45
4

There are a number of ways to accomplish what you're describing:

If your environment allows for it, a SharePoint hosted App would be a great solution that would incorporate all the look and functionality of SharePoint while providing a shell for your content.

You've referenced not using a Content Editor Web Part, but that approach would do very well given what you've asked about content getting "injected" into a SharePoint page -- you just point the CEWP at your js file and make updates to the js file.

You could also use a regular html page somewhere, but you'll run into issues getting all of the SharePoint infrastructure boot-strapped.

1

If you use your own HTML then you will lose the SharePoint look and feel plus you will loose your ability to query SP API's and Context.

If its a simple page that has nothing to do with SharePoint then you can just place the HTML page inside a library and it will work.

  • It has todo with sharepoint and i need also to access APIs and SP Context. But isnt there another way to have a "page" instead of only the CEWP? I mean something what i can upload and it gets "injected" within SharePoint? – BOG Jul 7 '16 at 15:12
  • For you want to have SP capabilities then you should create Page using the approved methods. Then you can edit the page in SharePoint Designer and add your HTML without adding a webpart. – Amal Hashim Jul 7 '16 at 15:15
  • create Page using the approved methods. Then you can edit the page in SharePoint Designer -> could you please provide some details on this? – BOG Jul 7 '16 at 15:17
  • You can use a Page Viewer instead of a CEWP; or a Wiki Page. It doesn't make much sense in a SharePoint environment to use a plain html page. Why do you object to putting it into a web part? – Erin L Jul 7 '16 at 15:17
  • 1
    @STORM Download the file, edit in your program of choice, re-upload using the UI or if you're on a windows machine open the page library in explorer view and edit the file in place; either would work – John-M Jul 7 '16 at 17:48
0

You can upload the HTML page into the Library but will not get the advantage of the SharePoint APIs.

I would highly recommend to use the content Editor webpart if you can.

Another thing, you have to keep in mind, once you upload the HTML page into the SharePoint then you have to change the Browser File Handling from strict to permissive in order to open the files in Browser.

http://paritala-sasi.blogspot.com/2009/12/opening-html-files-in-sharepoint-2010.html

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.