I am using Pannellum, a free panoramic viewer which uses HTML5, and developed using JavaScript.
http://www.mpetroff.net/archives/2012/05/28/introducing-pannellum/
The application works well, if the image is on web, but if it is local (assume that I have a html file locally and I want to open a panoramic file locally). It doesn’t work.
Is there any way that I can address a file locally and let this application works? It seems that it is using three.js and loads image using image() control.
I need to be able to use this application to download local file when it is opened in local browser. I am aware that a JavaScript from a web site cannot open a local file, bit in this case, al files are local.
Have a look at this wiki:
https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally
Related
I have a web project that I made with HTML-Javascript. I want to use the XML file (in local project folders) in this web project in javascript. Then I want to make a few changes in this XML file and overwrite the same xml file again. How can I do that?
JavaScript runs in the browser and is isolated from the local system. So the usual way is to upload/download the file. However here are several possibilities.
A small server application
Develop and start a small server application for example with node.js. The server part will provide the file system access.
Use a wrapper
A more advanced version of the previous solution, you encapsulate the web application using a wrapper like Electron.
File System Access API
Use the File System Access API available in some of the new Chromium based browsers.
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 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
I'm developping an android application and I'm using local html files, therefore I use the js libraries and css's locally. The problem is that they refer to relative images on the web, I download them and try to refer them locally as well, but it does not work.
Any suggestions?
So I have this html page. Inside of it is a bit of javascript code that talks to a flash application.
During the flash application's lifecycle, it'll save a file to a place on the server using the javascript on the html page.
How can I use javascript to take the file I just saved and move it to a different location?
You cannot. Javascript works on a client and don't have an access to the server's filesystem.
You can only trigger a script on the server that does that.
As you said you have node js installed and running on the server,it is possible for you to move a file using the nodejs filesystem api: http://nodejs.org/api/fs.html#fs_fs_rename_oldpath_newpath_callback
For this to work you would need to monitor and detect when new files are saved in a certain folder, which should be possible using: http://nodejs.org/api/fs.html#fs_fs_watch_filename_options_listener
Happy coding!