Chr*_*ams 9 safari mobile-safari
当我输入
window.location
Run Code Online (Sandbox Code Playgroud)
我对所有属性都没有定义.
这是我的控制台:

小智 5
此代码适用于Safari(6.0.1)及更早版本
// Get location for REST TARGETS
lcnURI = window.location.protocol + "//" + window.location.hostname + ":"
+ window.location.port + "/rest/";
Run Code Online (Sandbox Code Playgroud)
当你在日志中查看时,window.location似乎"脱离了上下文".但到位使用它很好.
我可以确认这一点(版本 6.0 (8536.25))。据我所知,这似乎是 Safari 的一个错误。
\n\n在 jsbin 上测试(http://jsbin.com/enugoj/1/):
\n\nconsole.log(window.location);\nconsole.log(window.location.pathname);\xe2\x80\x8b\nRun Code Online (Sandbox Code Playgroud)\n\nSafari 控制台中的结果:
\n\nLocation\n ancestorOrigins: undefined\n hash: undefined\n host: undefined\n hostname: undefined\n href: undefined\n origin: undefined\n pathname: undefined\n port: undefined\n protocol: undefined\n search: undefined\n __proto__: LocationPrototype\n\n/enugoj/1\nRun Code Online (Sandbox Code Playgroud)\n\nChrome 中的结果(版本 21.0.1180.89):
\n\nLocation\n ancestorOrigins: DOMStringList\n assign: function () { [native code] }\n hash: ""\n host: "jsbin.com"\n hostname: "jsbin.com"\n href: "http://jsbin.com/enugoj/1"\n origin: "http://jsbin.com"\n pathname: "/enugoj/1"\n port: ""\n protocol: "http:"\n reload: function () { [native code] }\n replace: function () { [native code] }\n search: ""\n toString: function toString() { [native code] }\n valueOf: function valueOf() { [native code] }\n __proto__: Location\n 1:14\n\n/enugoj/1 \nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
3503 次 |
| 最近记录: |