I've embedded a virtual tour on one of my client sites.
The site is hosted by Slicehost, and as you can see the load times for the Flash movies are very slow, so my idea was to serve the swf files from Amazon S3 Europe.
To test it, I have all swfs uploaded to the same directory / bucket on Amazon, while the index.html and p2q_embed_object.js files reside on my local machine. The js file is changed to refer to the Amazon-hosted swfs. The first swf loads fine, but the others don't. What am I doing wrong? Is there a better way to do this that would allow me to serve my Flash assets from elsewhere?
The solution is to use an iframe that calls a separate html file e.g. video.html. This resides in the Amazon bucket and calls the js and all swfs from the same bucket.
Related
I've been working on a game in javascript for my CS course. When I open the document by hitting run in Webstorm, it loads the game correctly, however when I just try opening the html file from Finder, the webpage opens but none of the png files I'm using for the sprites load. I opened Inspect Element in google chrome, and the javascript files loaded correctly but all the png files listed as canceled. This doesnt happen when the game is run from webstorm (when I run it from webstorm, all image files load properly).
When the game is opened directly from an html file (that's when I have the problem), chrome lists the path of the html document as the webaddress, although when opened from webstorm, it lists http://localhost:63342/CS%20Week%2010/CS105_Jessica.Davis_DogGame.html?_ijt=tmrr2fndgac82h07hlvt101gi4
How can I get around this issue so that when opening the html file from Finder it loads everything correctly? All image files are in the same directory as the html file.
Because of browsers security, loading files like this might not work from a url starting with file://
What webstorm is probably is making a local web server so that instead of saying file:// you could say http://. if any website was able to load images from file:// then any webpage you visit would have been able to search for any file on your computer and send it over the internet without your consent so browser often have these settings on. So you'd need a server. If you are working on your computer, you could make a local server just like webstorm and host your own files there. or host it on another service like github pages or codepen.
Now since all images are in the same directory, make sure that every time you call loadImage you use the images name and extension instead of saying /User/user/whatever_other_directory_you_have_it_under/image.png.
Once you did that you can make a local web server for the project. To make a local server, open Terminal (an application under utilities, you could spotlight search for it as well) and type cd, drag your project folder and drop it over terminal, and hit enter. Then type python -m SimpleHTTPServer and wait till it says something like Serving HTTP on 0.0.0.0 port 8000 .... Then taking the 0.0.0.0 and the 8000 you see in the example (yours may or may not be the same) go to your browser and type http://0.0.0.0:8000 (replacing the digits with whatever you got, not this link doesn't work until you do that)
Images should load alright. If you need to stop the server you can go back to terminal and hit control+C.
Note that when presenting your p5 sketch, no one else would be able to see the website on their computers if you make your local server. The local server is secluded to the device that is running it (although if their making their own local server and have your project files it should work just fine).
If you want the website hosted so that you could share a link with anybody in the world you could use codepen or github pages. If you go to codepen.io it should be self-explanatory although you'd have to upload your images to some image hosting site like tumblr or something and add the URL source of those images to codepen or you could put everything into github for even better results!
To use github pages you'd need to make a github account (preferably with your username being whatever you want your page to be named). Make a repository named insert_username_here.github.io. add your files to the repository (make sure to try to keep all sub directories and folder exactly as they are from your project folder). After a minute or two go to http://insert_username_here.github.io to admire your brand new hosted webpage!
First I have to say I'm very new to Google Chrome App development. I'm using webkitRequestFileSystem to create folders and files dynamically from my app.
Now where can I find the folders and files in my file system, or is there any other way to see them?
It will be buried deep into your Chrome profile, with all file names and paths obfuscated and complex metadata dependencies.
Something along the lines (from the root of the profile folder):
Storage/ext/your_app_id_here/def/File System/
The filesystem is virtual: it's not expected to map to a location within a user's filesystem, and you're not expected to be able to access it outside Chrome. The fact it's actually stored as a collection of files that correspond to virtual files is but a technical implementation detail.
If you want to interact with the real filesystem, you need to request access to a folder from the user using chrome.fileSystem.chooseEntry API for Chrome Apps instead of webkitRequestFileSystem.
I have created a webapp using JSP,Html and Javascript which currently runs on my localhost using apache webserver. I want to display the files and folders and of a directory in local computer. I also want to create a download link or view link of those so that when anyone click on it it will be viewed in new tab or become downloadable as it happens in any ftp server. I know similar type of question has
been asked but none of them worked for me.
To create the download link I used
Download
this does not work as it is not in my webapp path and download attribute also does not work in internet explorer.
I'm not sure why you are exposing your local drive contents on the web but here's an option:
On the page that should display the files, in java code, list all
folders and files then for each file/folder show a link to some page
(for example "navigateLocalDrive" that sends the path of the clicked
file/folder like this:
Download
Now in that jsp, check if the GET variable is a path for a file or a directory,
if its a file, just send it back in the response, if its a
directory, list all files/folders and do the same as in step 1
Please note:
How I encoded the file path in the href in order to work properly.
The Access permissions for the webserver should allow write/read to that path (I'm already doing it on my Tomcat server on local host with the default setup no change needed)
For your reference, here are some helpers for this task:
How to list contents of a server directory using JSP?
Downloading file from JSP/Java
I am not sure if this is possible. In general the access rights are limited to the src and webContent Folder (for your html coding mentioned above for sure) . This is also reasonable, because you do not want to access or change data on your Computer in general, because after local development you want to deploy your web application to a server.
To make a test copy some file to the webContent and you will be able to download it. Within your Java coding you can use some IO package like java.io.File to navigate over folders and files. However keep in mind, that you will get some exceptions like
java.io.FileNotFoundException: C:\WeatherExports\export.txt (Access is denied)
if you want to access files outside the server.
I have several users on an intranet and all have a mapped drive to server (E:).
All users are on Win7 and use FireFox.
I have used XAMPP on the server to allow users access to MySQL files using PHP.
They currently use windows explorer to open a folder on (E:) so save/modify files (jpgs, docs etc.).
I want to put a link in the html to open this folder for them.
I've spent some time researching this with varying amounts of success and I have found out that this may have security issues such as...
A web application does not have access to the local machine's filesystem
but these are all clients accessing the same server on a local intranet.
I can type...
file:///C:/MyFolder/MySubFolder/
in my browser address bar which opens a page with a directory listing of the files in the sub folder. Not ideal but half way to a solution!
But the script below does not work...
window.open("file:///C:/MyFolder/MySubFolder/");
Can this be done?
you path would be
window.open("http://localhost/MyFolder/MySubFolder/");
or
window.open("http://IP/MyFolder/MySubFolder/");
use absolute path for this
Firefox will work if the link is in its own mangled form using five slashes (file://///C:/MyFolder/MySubFolder/) and the user has disabled the security restriction on file: links in a page served over HTTP.
check this post for more info
I'm helping a coworker to code an html page that has to display contents (documents) of a local network share.
Html page will not be served by any web server, it will be just a plain html page on file system.
Does anyone know some Javascript libraries that let users browse the share, listing files and folders?
No, it doesn't exist. Same origin policy makes this problematic.
If such a javascript existed it would have to be served by the system and port that the file share was on. Which sounds like it defeats the point.
Now there is an index listing service built into most web servers that can list the contents of a web folder for a browser. There is also a similar capability in the browser for ftp.