[RESOLVED]HTML5 Help Needed

CyberKID
CyberKID
from India
10 years ago

[RESOLVED]

Sorry guys and girls, I'm back again with one more problem.

This time too, related to my blog only.

I've created a download page on my blog, from which, I plan to enable the visitors to download images that I'll put up on the downloads page.

To do this, I've planned to make use of a new feature in HTML5 which allows one to click on a normal link to download common files like images/pdf's and such, which normally opens in the browser itself.

The HTML attribute I'm talking about is:

http://www.indiblogger.in/someurl.com/downloads/someimage.jpg

I've posted a link to on another domain I own, for users to try, because, this is a problem which can't be conveyed without checking a live example. http://www.techuri.com/download_gallery.html

Please note that this is not a link to my blog, but, a separate domain which is still not being used to host a website, so, driving traffic to the domain name isn't an intention here.

 

There's a download link for each image in the gallery that's located at the right hand side, just below the image. Now the problem is, the code to download the image "which is hidden underneath the text "Download Original" is working perfectly in Google Chrome, but isn't working on Mozilla Firefox (haven't checked other browsers thoughTongue out)

I hope I'm pretty clear this time, not to confuse anyone. In case anyone is still wondering what I want, I'd like to tell them that I want the link to download the image by clicking the link, not to open it in the browser, which firefox is doing currently with my code. Please check the page in Google Chrome first, and then in Mozilla Firefox to understand the problem.

Now I think, the issue is resolved. Moving the images to an external host did the trick. No need to try and work around on any server side scripts. Apart from google, I tried this with flickr too, but it too isn't working, for image downloads.

In case, you want, you can create a google sites website to host the images (though, here you have a very limited space, I think 100mb or so), or maybe, use any sharing solutions like dropbox (I'm not sure whether it would allow downloading images this way, or not, as I haven't tested it yet). Apart from that there are free web hosting service providers like 000webhost.com and somee.com to name a few, which allow you to host your files on their servers, beyond providing you a free domain name too something like yourdomainname.000webhost.com or yourdomainname.somee.com, which would help you access the files you're hosting on these servers.

Edited 10 years ago
Reason: Query Resolved! Updating with a possible solution.
Replies 1 to 5 of 5 Descending
Vijay Prabhu
Vijay Prabhu
from Mumbai
10 years ago

Right Clicking and selecting save link as works in Mozilla

CyberKID
from India
10 years ago

Thanks for the reply Vijay, that would have been the ultimate choice, but, since I don't want the user to do that much, I need to fix this.Sealed

Ranjith
Ranjith
from hyderabad
10 years ago

1. Pankti jaldi aa jaeye aur doubts pooch lo Tongue out

2. CK I asked you to praise me but you didn't. CryUndecided

.

Here is what we ( I Cool Tongue out) have found after a short discussion on IndiTalk.

Cross site origin policy is implemented in firefox for the download attribute i.e. a file from xyz.com will be downloadable using that HTML5 attribute if and only if that attribute is on a page from xyz.com.

Others are free to find a workaround now. Money mouth

Vijay Prabhu
from Mumbai
10 years ago

See Ranjith he thanked me Tongue out

Ranjith
from hyderabad
10 years ago

CK Say thanks to me also :-w

CyberKID
from India
10 years ago

Thanks for your reply Ranjith. You've helped me understand a cause for the issue. I'll check out the cross site origin policy thing and will try a workaround for it.

Maybe, I can try doing the download that using an external server, by specifying content disposition headers, or maybe, use google sites to host the image files, as it, by default sets the content disposition headers as attachment, for uploaded files, or even using a php download page, to handle download requests. Anyways, thanks for your help. I'll update here as and when there is a progress on this matter.Smile

 

Ranjith
from hyderabad
10 years ago

Finally got my thanks Cool

CyberKID
CyberKID
from India
10 years ago

I'll have to see what's cross site origin policy and how does it effect the working of an HTML feature, which, ideally shouldn't be affected by whatever mozilla implements in firefox.

Ranjith
from hyderabad
10 years ago

I meant same origin policy. Undecided

Renie Ravin
Renie Ravin
from Chennai
10 years ago

Ranjith is right, as always... the Mozilla team believes that this feature can be used to fool a user into downloading his own user information (from gmail, for example) and then being fooled again to send/upload this information to the malicious website owner. Having said that, I can't resist linking to this video. Laughing

@Cyberkid, you could try using a server-side solution without having to worry about html5 support. This thread on Stackoverflow may point you in the right direction; if it doesn't help, let us know - we'll make this an IndiChallenge! Smile

 

Ranjith
from hyderabad
10 years ago

Laughing

I'm wondering since when did Renie start answering tech questions. InnocentTongue outLaughing

we'll make this an IndiChallenge!

CK needs it for his Blogger blog. So, server side solutions won't work. Undecided Are there any prizes for the IndiChallenge? Laughing If yes, I might be tempted to design a new browser which supports only a tag with download attribute and nothing else. Tongue out And name the browser Mozilla Firefox. Tongue out

CyberKID
from India
10 years ago

Thanks, for your help, sir. And, also, for more info on the firefox's inability to do this. I see that Ranjith has pointed out the issue I'm facing, so, no server side scripts. I need to include the html code in this download page in one of my blogger pages, so, can't make use of any server side scripts. Maybe, I can try hosting the images on an external domain and then try getting it done from there. I think, that can help me out, in resolving the issue with this cross site origin policy thingy, as we've seen that the images hosted on my google account aren't being downloaded in Firefox, while ones hosted on a different hosting account are getting dowloaded.

I'll try this and post the results here.Smile

CyberKID
CyberKID
from India
10 years ago

Resolved! Using links to the image files hosted external host did resolve the issue. Maybe, somehow hosting the image files on my google profile wasn't working for the downloads link in Firefox. It is working properly for the images in mozilla Firefox too.Laughing

 

I think I must mark this thread resolved. What you guys say?

Ranjith
from hyderabad
10 years ago

What you guys say?

Yes Tongue outWink I think it was the content disposition header which did the work.

But before closing the thread, I want someone to explain the following. Innocent

 this feature can be used to fool a user into downloading his own user information (from gmail, for example) and then being fooled again to send/upload this information to the malicious website owner. 

CyberKID
from India
10 years ago

Ok, Ranjith, maybe, that was something related to concern that someone could link up to some malicious code, or scripts (like VBScripts, etc) that could be used to breach the security and privacy of users. It is a possiblilty, but, since there is no link cloaking (to hide the actual link and show something else as a download link) available here, users can see the actual link of the file being downloaded, or linked to the Hyperlink on the page). While the possibility of the users checking the hyperlink each and every time is quite low, as most people don't bother checking what they are downloading, a bad guy can link a malicious script that would be downloaded without the browser asking for a confirmation to do so, just by clicking the link, and that's where it becomes dangerous.


LockSign in to reply to this thread