I am writing a small application using backbone, jquery and node. As part of the application, i want to list files on browser. When user clicks on any file, i want to open up a doc viewer window.
I tried some plugins like google doc viewer, jquery plugin etc. But not able to access files on my system.
Is it possible to access local files with available plugin. Do i need to add any headers as part of the request to specify it as doc viewer request.
I am new to jquery and front end technologies. Can someone explains with little patience.
Related
We have one requirement where we need to generate HTML to PDF and store it on document Library.
So far we are able to generate the HTML to PDF but not able to store it in SharePoint Document Library.
Note: we are using kendo plugin for PDF conversion, Kendo giving SaveAs option to save the PDF locally, our requirement to store the PDF in SharePoint Environment.
Code Snipped:
kendo.drawing.pdf.saveAs(“PDFName”)
If anyone did similar requirement in past Please revert back to me.
We are Interested to achieve the solution with Client side programming. MS flow is not in scope as of now.
You could upload the file to sharepoint library via rest api:
create a file and add it to a folder.
And below is a sample:
How to Upload File in Document Library in SharePoint Using REST API & jQuery
Is there a way to replace a .js file in the website sources with a file on my workstation, or make a modification to a .js file and refresh the website to see the changes?
I am developing client-side JavaScript code against a SharePoint website on a server. I cannot create a local version of the website, so I need to modify the script, save the file to the server, refresh, etc. I do not have direct access to the server, and saving a file in a SP doc library or web part takes a lot of time between edits.
I can make small modifications using the dev tools while breaking on certain lines and applying snippets, but I am hoping for a better way.
Thanks!
If you have access the server that's hosting the file you should be able to replace or modify the JS file. Alternately you can use local hosting tools to test your file and then upload it to the server once you've confirmed it's working.
If you explain what you level of access to your host is we can offer better suggestions.
I am developing a tab pane app in Excel which needs to read the current document. In Word, the Office JavaScript API has the method Office.context.document.getFileAsync(), but this is not available in Excel.
I can get the URL of the document with Office.context.document.getFileProperties(), and then I thought I could read the file with this.
I tried using the HTML5 FileReader() object, but this only works for files selected from the file input control. I tried manipulating a hidden file input control so it automatically uses the current document, but JavaScript understandably prevents you from doing this for security reasons. I could ask the user to browse to the document they are currently using but that would be a poor user experience.
So I tried using ActiveXObject('Scripting.FileSystemObject') but ActiveX is not allowed in tab pane apps at all, whatever the current security setting are in IE.
What other options do I have?
According to the API road map, Office.context.document.getFileAsync() is not available in Excel at this moment.
I don't think it's feasible by using getFilePropertiesAsync(). It only returns the URL. Usually browser forbids developer touching any content in the file system. Therefore, it's hard to access the local file system in JavaScript code.
Besides, the file may not be in local file system. For example, it could be hosted in Onedrive or SharePoint. getFilePropertiesAsync() should return its real URL in Onedrive/SharePoint, instead of local file system.
I guess Microsoft will support getFileAsync() in the future.
I am working on angularjs java project. I won't to load local files of all file types (txt, pdf, image files etc.) from my system into new tab on click of button using javascript, angularjs or java code.
I able to load the content of the files but it is not displayed in correct format ie. I won't to load the file in similar format as they are placed on my system.
I would be thankful if anyone could help me in finding the solution.
You can't simply expect your browser to display the file as it is displayed in your local system.
If you try uploading a file and then viewing it, the browser will download the file and technically, you then view the file locally.
There are a few Cloud Storage options such as Box.com and Google Docs that have their own file explorer (that support limited file types). I don't think there is any free library available that does that as it requires quite an effort to support many file types for display in the browser.
This requirement can be achieved by following directive ng-bind-html in angular Js .
Kindly refer the examples and documentation which is given in Angular Js website
$sce is a service that provides Strict Contextual Escaping services to AngularJS.
Check this link for directive documentaion
For viewing pdf use ng-pdfviewer, include ng-pdfviewer.js as JavaScript file, along with pdf.js and pdf.compat.js.
Declare ngPDFViewer as dependency to your module.
You can now use the pdfviewer tag in your HTML source.
Click here for GitHub link for ng-pdfviewer
Use <img ng-src="image.jpg"/> for images
The new version of Linux Mint allows HTML 5 login window themes -- I'm trying to write one that will grab each user's wallpaper. These wallpapers are located in the folder /home/#USER#/.cache/wallpaper/, however the file name is not consistent and I need a programmatic way of determining it. Once I know the filename, the login screen will display the image correctly using the file:///.. format.
I don't have any tools other than client-side HTML/CSS/JavaScript[/jQuery/etc] available to me. Is there any way I can grab the file names in that directory, so that I can grab the wallpaper image?
EDIT: Figured it out! The browsers won't allow access to the file:/// resources at all, the mdm-theme-emulator will.
It looks like these files are located on the client machine, in which case you would not be able to access them using jQuery. Javascript does not have access to the local file system.
If you are sending the request through a server, you'd be able to use the server-side code (ASP.NET, PHP, etc.) to loop through the filenames