Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: files/download.js

Issue 8493027: Acquired Opera AdBlock code (Closed)
Patch Set: Created Oct. 8, 2012, 5:58 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « files/default.js ('k') | files/lists.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+}
« no previous file with comments | « files/default.js ('k') | files/lists.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld