Index: files/download.js |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/files/download.js |
@@ -0,0 +1,16 @@ |
+function download(url) { |
+ if(url.indexOf("http") == 0) { //Only accepts http and https URLs |
+ try { |
+ var request = new window.XMLHttpRequest(); |
+ request.open('GET', url, false); |
+ if(opera.version() >= 12.1) |
+ request.timeout(12000); //Only supported in Opera 12.1+, 12 seconds timeout |
+ request.send(); |
+ if (request.readyState == 4 && request.status == 200) { |
+ return request.responseText; |
+ } |
+ } |
+ catch(e) {} |
+ } |
+ return false; |
+} |