proxy.js 419 B

12345678910111213
  1. /*
  2. proxy.js
  3. This script help proxy text content of the requested page and render them locally
  4. */
  5. //Get the target webpage body
  6. requirelib("http");
  7. var websiteContent = http.get(url);
  8. //replace the relative path files with absolutes
  9. websiteContent = websiteContent.split('src="/').join('src="' + url + '/');
  10. websiteContent = websiteContent.split('href="/').join('href="' + url + '/');
  11. sendResp(websiteContent);