View HTML file directly vs. downloading as attachment - box-api

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?

Related

How to host static html page on SharePoint online

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.

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.

box-api override embedded viewer to view html

Is there a way to share a complex HTML file with box? Currently when I share an HTML5 file it opens in the embedded viewer and it is not rendered correctly. It would be great if I could share a file that could be responsively rendered on all devices without the need for it to be on a hosting site.
For paid Box.com accounts only, you can use a direct link as outlined here:
https://support.box.com/hc/en-us/articles/200519908-Direct-Linking
Unfortunately, with a complex HTML file as you're describing, it may not render properly anyway depending on the browser/device, since the file is downloaded as an attachment and not viewed in the browser via box.com.

Google Docs Viewer for rendering HTML

I'm using Google Docs Viewer (https://docs.google.com/viewer) to display the contents of documents in my app. I support many different types of document (e.g. PDF, Microsoft Word, Plain Text, HTML, etc.). Everything works well except for HTML. Google Docs Viewer treats HTML as text and displays the source.
Is there any way to get Google Docs Viewer to render the HTML?
Here's an example:
https://docs.google.com/viewer?url=http%3A%2F%2Fwww.google.com&embedded=true
Instead of rendering the Google home page, it shows the HTML mark-up.
I'm hoping I can use the Google Docs Viewer for all types of documents and not have to treat HTML differently.
Imagine an attacker uploads an HTML file of google's sign page
Makes the html public and sends it over the email to your gf with the subject
Flash Fashion Sale Discount Coupons
Your gf will obvious click the link and won't be surprised to see Fake google sign in page on a docs.google.com domain .
She will convincingly enter her real credentials and will be redirected to attacker's server and then some real google docs page to remove suspicion.
So to prevent users from phishing attacks google stopped rendering HTMLS
source