【发布时间】:2015-11-10 19:58:16
【问题描述】:
我想拍摄我的 angularjs SPA 的 html 快照。 Angular 应用程序正在从另一个域上的 tomcat 服务器获取数据。 SPA在chrome浏览器上可以成功获取数据,但在phantomjs浏览器中出现以下错误。
ERROR{"data":null,"status":0,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"https://localhost:8443/gomovie/control/getHomeData","headers":{"Content-Type":"application/json","Accept":"application/json, text/plain, */*"},"data":""},"statusText":""} (from line #undefined in "undefined")
Angular 应用程序使用 nodejs 服务器提供服务,如果 url 中有 ?_escaped_fragment_,它会调用 phantom js 来拍摄 HTML 快照。服务器是使用内部使用 tomcat 的 apache ofbiz 部署的。我使用了 Tomcat 提供的默认 cors 过滤器来支持服务器端的 CORS(它至少适用于 chrome 和 firefox)。
【问题讨论】:
-
什么是服务器响应头?
-
如果你能告诉我你想使用的 url,我可以看看 phantomjscloud.com 是否能更好地呈现它。如果是这样,我可能会提示您做错了什么
标签: javascript angularjs node.js seo phantomjs