views:

248

answers:

2

I am using localgetstorage and setstorage to load a list of links and show them as in a slideshow. The problem is that when I preview it on my PC it works, as soon as I try to use the page in my server online it won't work. Have I done something wrong?

Here's a link:

http://hem.bredband.net/noor/bildspelet/bildspelet.html

It is very buggy and I'd rather just use a thirdparty slideshow plugin but I don't know where to find one that matches my needs and is free..

+5  A: 

Do you reference the images in the right way? If I take a look at the source of your provided Link, I see references to your c:-Drive:

<b>C:\Users\Admin\Pictures\IMG_0005.JPG<br>
C:\Users\Admin\Pictures\IMG_0631.JPG<br>
C:\Users\Admin\Pictures\IMG_0322.JPG</b><br>

I know, in this case it's just plain text, but if you reference the images in the same way, it would explain your problems...

Ralf
Hm...maybe a prefix with file:// would help out.
justkt
even with a file:// you would run into problems. file:// is a security risk and hence this protocol will only work for trusted (local) domains. And the pictures would also only be locally visible - is that what Noor wants?
Ralf
@Ralf - Considering the comment that he wants to pull images from the hard drive above, sounds plausible.
justkt
@justkt- yes, but why put the html on a server in this case?
Ralf
@Ralf - Sorry for being afk, you are correct, the only thing I want to do is make the pictures be locally visible, the reason is that I'm trying to make a screenshow. I want my site to be your start page and when you're afk for a while and you've left the browser window open you'll see the slideshow, just like a screensaver works.. I think I should try to find a plugin that allready does that maybe, I just don't like giving up!
Noor
@Noor - ok. as a "screensaver" it could make sense. But I guess you should use another source for the pictures (maybe flickr?) which is accessible for all of your users.A normal website is not allowed to reference local files - already the check for existence can be enough to attack a system. So in order to make your page work, you have set it as trusted site in your browser. Will your users do that? The whole site will be trusted and hence has special permissions...
Ralf
+2  A: 

You can't read a local file in your HTML page unless you use the FileAPI (using a fileReader) But it is only implemented in firefox 3.6+ yet. May be it will be also in chrome 5.0

Here are some articles on this subject and a demo

You can also use OfflineAPI to store information about the file selection and DragDrop to extend user experience

Cbe317
I'm really doubting your answer allthough I'll accept it. I'm only doubting for one reason which is that I think I got it working, I might be wrong.. don't think so but for now I'll go with it. Thanks!
Noor
Excuse me I was not very clear. When you load your HTML page from your computer (with file:///path-to-your-html-file), you can see pictures from your local computer. But when you load your HTML page from a server using http:, you change the protocol (from file: to http:) and security constraint don't allow you to see the content of file using the protocol file:. To bypass these constraint you should use HTML5 APIs, but it is not yet implemented in browsers except Firefox 3.6+.
Cbe317
You can find some explications on how to use the file API in this article : http://www.incaseofstairs.com/2010/05/border-image-generator-local-file-access/
Cbe317