Skip to content

Instantly share code, notes, and snippets.

@nikiink
Last active April 14, 2016 09:26
Show Gist options
  • Save nikiink/0966d5bc50a1fec7e2b7062f1d0bbc6f to your computer and use it in GitHub Desktop.
Save nikiink/0966d5bc50a1fec7e2b7062f1d0bbc6f to your computer and use it in GitHub Desktop.
Sitecom WL-153 v1 002 administration interface chrome support
/*
==============================================================
Created by Xploïse: www.xploise.nl
for Sitecom Europe: www.sitecom.com
==============================================================
*/
// ADDING THE NEXT ROW THE ADMIN INTERFACE WORKS ON CHROME
// Replace the readfile.js with this readfile.js. It can be done
// using the chrome extension Requestly. Add a redirect request rule
// where source equals http://<ROUTER_IP>/readfile.js to the url of this file
// generated using rawgit:
// 1. click on Raw button of this gist and copy the url
// 2. go to rawgit.com and past the url
// 3. copy the rawgit production url and use it in Requestly
// for example i get this:
// https://cdn.rawgit.com/nikiink/0966d5bc50a1fec7e2b7062f1d0bbc6f/raw/369cb26eec26d5c2a98474814a6449359dd738b7/readfile.js
window.netscape = false;
function readFile(url)
{
var req;
if (document.all){
req = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (netscape){
if (document.getElementById){
req = new XMLHttpRequest();
}
else {
req = new NS4HttpRequest();
}
}
else if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
}
req.open("GET",url,false);
req.send(null);
return req.responseText;
}
function NS4HttpRequest()
{
this.url = "";
this.responseText = "";
}
NS4HttpRequest.prototype.open = function(method,url)
{
this.url = url;
this.method = method||get;
}
NS4HttpRequest.prototype.send = function()
{
if (this.url=="") return false;
var line,buffer;
this.responseText = "";
buffer = new java.io.BufferedReader(new java.io.InputStreamReader(new java.net.URL(this.url).openStream()));
while ((line = buffer.readLine())!=null) this.responseText+=line + "\n";
if (buffer!=null) buffer.close();
return true;
}
@nikiink
Copy link
Author

nikiink commented Apr 14, 2016

The admin interface of Sitecom WL-153 v1 002 opened with chrome generate the error netscape is not defined and the page is not displayed correctly. Defining on the top of the file readfile.js the global variable window.netscape to false resolves the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment