quando digitoPerché window.location indefinito su tutte le proprietà in Safari 6 e Safari Mobile (iOS 6)
window.location
ottengo non definito su tutte le proprietà.
Ecco la mia console:
quando digitoPerché window.location indefinito su tutte le proprietà in Safari 6 e Safari Mobile (iOS 6)
window.location
ottengo non definito su tutte le proprietà.
Ecco la mia console:
posso confermare questo (Versione 6.0 (8.536,25)). Sembra essere un bug di Safari, per quanto posso dire.
Testato su jsbin (http://jsbin.com/enugoj/1/):
console.log(window.location);
console.log(window.location.pathname);
Risultati in console di Safari:
Location
ancestorOrigins: undefined
hash: undefined
host: undefined
hostname: undefined
href: undefined
origin: undefined
pathname: undefined
port: undefined
protocol: undefined
search: undefined
__proto__: LocationPrototype
/enugoj/1
Risultati in Chrome (versione 21.0.1180.89) :
Location
ancestorOrigins: DOMStringList
assign: function() { [native code] }
hash: ""
host: "jsbin.com"
hostname: "jsbin.com"
href: "http://jsbin.com/enugoj/1"
origin: "http://jsbin.com"
pathname: "/enugoj/1"
port: ""
protocol: "http:"
reload: function() { [native code] }
replace: function() { [native code] }
search: ""
toString: function toString() { [native code] }
valueOf: function valueOf() { [native code] }
__proto__: Location
1:14
/enugoj/1
Sì, è esattamente quello che ottengo ... tutto indefinito :( –
Questo codice funziona in Safari (6.0.1) e precedenti
Sembra che window.location "esca dal contesto" quando si guarda nel registro. Ma sul posto usato va bene.
Il fatto è che mi aspetto tutte le proprietà dell'oggetto posizione, non solo l'URI. –
La registrazione di 'JSON.parse (JSON.stringify (posizione));' funziona correttamente (i metodi come 'ricarica' sono persi, ma non sono comunque necessari per l'ispezione). –