How to host static html page on SharePoint online - html

We have a simple HTML page with some embedded JS. We used to host the pages with the .aspx extension on the on-premises SharePoint where you can click on the file and it opens like a regular page. When doing so on an online version of SharePoint it turns out that instead of opening a page it downloads it. I tried to use SharePoint designer to point it to the page but no luck, also I tried to embed the page with the embedded plugin on SharePoint but it is very limited in usage (no scripts, no header with the stylesheet, etc).
So the question is how to make an online version of SharePoint to open HTML files as a regular HTML and display its content instead of downloading the pages?

We've found the odd behavior of SharePoint in conjunction with OneDrive.
It turns out that when you upload your HTML files (with changed extension to .aspx) into someone's shared OneDrive or SharePoint folder directly - it will just download the pages.
But if you first upload your files into your own OneDrive and then copy/move the content to the shared folder or SharePoint's folder - it starts to open the page as it would behave in the on-premises version of SharePoint.
So the solution is to upload files directly into your own OneDrive and then copy/move the files to SharePoint's folder.

Related

How to preview local files in the browser in another html page

i am looking for a creative solution for a new task.
my issue is we need a way to preview local files (extentions: doc, docx, ppt, pptx, pdf, tif, jpeg) in a frame or so of a different web page which provides a link.
preview should look like an image of the files or so.
we would like to prevent parsing the files to pdf in order to save time...
we are using angular 7, c# asp.net server side.
we are very limitted in most solutions, as the data is very secure and is used in an inner office net,
that is why we can't use the google docs solution.
i also understood that using iframe tag and pointing it src attribute to the file source doesn't load the page due to security resones.
in addition all users has the ability to preview the above files types when they do it straight from the document by the open with -> IE or other browsers options.
i tried :
<iframe src="file:///C:/Users/cd/Downloads/MyFile.docx"></iframe>
but:
the iframe tag doesn't open the doc file, i can see the iframe in the DOM as a new html but it doesnt have a content of anything
i tried also for images and the same, the frame is blank
If you are using chrome then chrome specifically blocks local file access this way for security reasons.
more detail is this link : here
One possible solution is, render the document pages as images and then display them on the web page i.e. using the iframe.
You may use GroupDocs.Viewer for .NET for rendering the document pages into high-fidelity images (PNG/JPG). You can then embed the images into your web page to preview the document. This is how you can get the image representation of the pages in a Word document:
using GroupDocs.Viewer.Options;
// Set output path
string OutputPagePathFormat = Path.Combine("D:\\output", "page_{0}.png");
// Render document pages
using (Viewer viewer = new Viewer("D:\\sample.docx"))
{
PngViewOptions options = new PngViewOptions(OutputPagePathFormat);
viewer.View(options);
// Rendered images will be saved in the D:\output\ directory.
}
Disclosure: I work as a developer evangelist at GroupDocs.

Display an HTML file on Google Drive?

How can I preview an HTML file on Google Drive? I did a bit of research and it seems hosting HTML has been deprecated by Google in 2016. I tried to open the direct link of the HTML file but it downloads it and doesn't display it. Any workaround ?
Thanks :D
Ironically Google, a company built on html, still has no good solutions for handling .html files on Drive: I'm web developer! If you create a .html file within any text editor (Mac, Linux or MS) and save it with a .html extension (e.g. test.html), that file is now a Browser file, not a text or Doc file. G-Drive was created to be a cloud replacement for MS Office suite of products (Word, Excel, and so forth). It will even save a .txt (or text) file, and display it back as such.
However, a file dropped in Drive (via the Chrome browser) with a .html extension; if you simply click on it, it will be opened by/in Docs, and displayed therein as a web page (and poorly too, since it cannot connect to the styling of the .css file). If you right-click on it, and select "display", it will give a similar display only without opening it in Docs. If you right-click and select "download" it will download in .doc format. Yes, worthless! I copy the html, code and all from the file on my PC, and paste it into a blank Doc file, which is OK for a backup of that file, plus it will spell-check and all, but it is not an easy way to cloud save or sync. And, it cannot open the browser to view it, because it is internal to (or already inside of) the browser. The only accurate way to preview a .html file, is for the file to be external to a browser (any web browser), and then opened inside or with that browser.
To repeat: If you simply click on it, it will be opened by/in Docs, and displayed therein as a web page (and poorly too, since it cannot connect to the styling of the .css file). If you right-click on it, and select "display", it will give a similar display only without opening it in Docs.
I am not exactly sure what you mean by display. If you just want to preview a file in google drive open it and see its contents then the only types are
PDF, Microsoft Office file, audio file, or photo.
Just double click your html file you can preview it in drive.
please see View and open files
If you are actually talking about web hosting a html file then. Hosting of HTML files from within Google drive was Deprecating in August of 2015 and shut down completely in August of 2016 so you can no longer host HTML files directly via Google drive Please see Deprecating web hosting support in Google Drive
Alternative would be to use Google Domains to host a site that way this option is not free as far as I know.

View HTML file directly vs. downloading as attachment

We have paid Box.com accounts. Our users occasionally want to upload complex HTML files to these sites to share with customers, as they don't have access to an internet-facing web host.
The HTML files are self-contained in that they have no references to other files in the box account. That is, all scripts, css, and images are publicly-accessible.
Using the Direct Link method of Box, the users can send the URLs to the client. However, when the clients access the link, the HTML files are downloaded as attachments, vs. being viewed "inline" in the browser. This causes the files not to function like a normal HTML file on mobile devices, because the attachment triggers a different viewer other than the standard browser.
What we'd like to do is literally open that HTML file right in the browser using the direct link. Is there anyway to override the forcing of HTML files downloading as attachments?

convert my website to a sharepoint site

I am new to sharepoint online 2013.
I have a simple mapping application(webmap with html5/css/js (javascript/jquery) that I would like to move into a sharepoint subsite/master site available to my sharepoint users (that they must be logged in to see)
How do I import the html5, css, and js to sharepoint as set up the page?
It keeps trying to get me to use templates and I am not sure where to put these files for my site. I am using sharepoint online 2013 and sharepoint designer 2013.
Please help Thanks.
The easiest way to get your site up and hosted inside SharePoint would be to rename all your .html files to .aspx and upload the entire thing into a document library including folders with your js and css files.
Your users would need to be logged in to see the pages and you would only need to modify your existing solution to change any .html links in the content to .aspx (I would just write a quick batch file to do this).
You can keep the exact format and structure you currently have so you don't need your supporting css and js to be in the Style Library, they can just be in the same document library in their own folders so your existing relative links will keep working.
You can create normal web part pages/blank pages in "Site Pages" and copy your html design structure.All the scripts,css will need to be uploaded to "style library" of SharePoint site.Below is link to create web part pages using SharePoint designer.
http://office.microsoft.com/en-us/sharepoint-designer-help/create-sharepoint-site-pages-HA101782505.aspx

Create a Sharepoint page from HTML file with images

I'm trying to create an editable page in Sharepoint. I already have the page in HTML (it's quite large) and it has many images in it. Previously I have just created a new page in sharepoint and pasted the HTML source in, the uploaded/inserted the images manually, one at a time.
Unfortunately, I am not able to do this in a reasonable amount of time since there are many images this HTML file is using.
So, I want an editable Sharepoint page that keeps the images intact from a directory that looks like this:
thepage.html
1.png
2.png
...
...
...
343.png
etc
Any ideas?
EDIT: For more clarity - this is a specifications document in HTML form, so it has a lot of text and header integrated with images. I'd like it to be converted to an actual Sharepoint Page that is editable from Sharepoint's interface.
Seems best here to use a low-tech solution, some HTML editing and use the best way for you to upload multiple files.
Assuming
C:\mypage
-> \page.html
-> \images\1.png
-> \images\2.png
...
-> \images\100.png
Via the UI
Go to a Document or Image library, and use the "Upload Multiple files/images" (this only appears on Internet Explorer)
Lets say you uploaded it to //sharepoint/myimages
Create a new content page (say an Article page, or WebPart Page with a Content Editor WebPart)
Lets say your page resides now at //sharepoint/pages/mypage.aspx
Change your html to point from <img src="images/1.png" /> to <img src="../myimages/1.png" />
Edit the HTML for your newly created page (Ribbon > Edit HTML Source), paste your HTML code
Via SharePoint Designer
Drag and Drop all the images in your desired location
repeat the HTML steps above
To replace text in bulk, SharePoint Designer, your favorite HTML editor or event Notepad can do that well using the CTRL+H menu / Edit > Find & Replace options.
NOTE: the //sharepoint address up there is the http url for your site, SO won't let me use a full fake address as a sample.
From IE or from Word, save the page as a complete webpage so it creates an HTML file plus a folder with the images.
In network places, create web folder (WebDAV) pointing to Sharepoint. This way, you can access it from the file system in Explorer.
Open your new network place, navigate to the library where you want your HTML file to be, and drag-n-drop the file and folder into there.
The file then will be visible in browser, with the pictures, but the folder will be hidden.
If I have understood correctly your question. You can use this post answer to load list of images by javascript and php ->
Load list of image from folder.
Upload files to Share Point server and use that folder.
Or you can dynamically write c# code to read Share Point folder and display images.