user_agent.sjs 626 B

12345678910111213141516171819202122
  1. function handleRequest(request, response)
  2. {
  3. // avoid confusing cache behaviors
  4. response.setHeader("Cache-Control", "no-cache", false);
  5. response.setHeader("Content-Type", "text/html", false);
  6. response.setHeader("Access-Control-Allow-Origin", "*", false);
  7. // used by test_user_agent tests
  8. response.write(
  9. "<html><body>\
  10. <script type='text/javascript'>\
  11. var msg = {\
  12. header: '" + request.getHeader('User-Agent') + "',\
  13. nav: navigator.userAgent\
  14. };\
  15. self.parent.postMessage(msg, '*');\
  16. </script>\
  17. </body></html>"
  18. );
  19. }