Your generous donation allows me to continue developing and updating my code!
1 Open this page in Safari 4.
2 Open the debugging Error Console (cmd-opt-C)
3
Notice that win_loc.href: string, loc.href: string, location.href: string, window.location.href: string
is getting printed to the console.
This is expected.
4 Navigate to a page on a different domain, like Google or GitHub.
5 Press the back button.
6
Notice that win_loc.href: undefined, loc.href: undefined, location.href: string, window.location.href: string
is getting printed to the console.
What's up with those undefined
, Safari?
Tested in Safari Version 4.0.4 (5531.21.10) / WebKit nightly r54415. Submitted to WebKit Bugzilla as Bug 34679.
The code
01.
(
function
(window){
02.
03.
// A convenient shortcut.
04.
var
win_loc = window.location,
05.
loc = location,
06.
state;
07.
08.
(
function
loopy(){
09.
console.log([
10.
'win_loc.href: '
+
typeof
win_loc.href,
11.
'loc.href: '
+
typeof
loc.href,
12.
'location.href: '
+
typeof
location.href,
13.
'window.location.href: '
+
typeof
window.location.href
14.
].join(
', '
));
15.
timeout_id = setTimeout( loopy, 1000 );
16.
})();
17.
18.
})(
this
);