getHeader.js 527 B

123456789101112131415161718192021
  1. /*
  2. getHeader.js
  3. Get Header of the target website and return it as JSON
  4. */
  5. requirelib("http");
  6. if (url == "" || typeof(url) == "undefined"){
  7. sendResp(JSON.stringify({}));
  8. }else{
  9. var header = http.head(url, "x-frame-options");
  10. var code = http.getCode(url);
  11. var redest = "";
  12. if (typeof(_location) != "undefined"){
  13. redest = _location;
  14. }
  15. var result = JSON.stringify({
  16. "header": JSON.parse(header),
  17. "code": code,
  18. "location": redest,
  19. })
  20. sendResp(result);
  21. }