J
James Marshall
I'm trying to override location.replace() but I can't. I can override
window.open(), document.write(), and other built-in methods, but not
location.replace(). Here's a demo that overrides two built-in methods,
then reports on them:
location.replace= function (url) { alert(url) } ;
alert('location.replace=\n'+location.replace) ;
document.write= function (html) { alert(html) } ;
alert('document.write=\n'+document.write) ;
The first alert shows location.replace is still "[native code]", while the
second alert shows that document.write has been correctly overridden.
The same happens if the first two lines above are put into the "onclick"
attribute of a button, so it wouldn't seem to be that the window.location
object's not created yet, etc.
Any ideas? Also, while window.open() seems overrideable in most browsers,
am I wrong to assume that location.replace() should be also?
(document.write is overrideable in Mozilla, which I'm using.) Note that
I'm using the actual window etc. objects this time, not the Window etc.
prototypes.
Thanks a lot!
James
.............................................................................
James Marshall (e-mail address removed) Berkeley, CA @}-'-,--
"Teach people what you know."
.............................................................................
window.open(), document.write(), and other built-in methods, but not
location.replace(). Here's a demo that overrides two built-in methods,
then reports on them:
location.replace= function (url) { alert(url) } ;
alert('location.replace=\n'+location.replace) ;
document.write= function (html) { alert(html) } ;
alert('document.write=\n'+document.write) ;
The first alert shows location.replace is still "[native code]", while the
second alert shows that document.write has been correctly overridden.
The same happens if the first two lines above are put into the "onclick"
attribute of a button, so it wouldn't seem to be that the window.location
object's not created yet, etc.
Any ideas? Also, while window.open() seems overrideable in most browsers,
am I wrong to assume that location.replace() should be also?
(document.write is overrideable in Mozilla, which I'm using.) Note that
I'm using the actual window etc. objects this time, not the Window etc.
prototypes.
Thanks a lot!
James
.............................................................................
James Marshall (e-mail address removed) Berkeley, CA @}-'-,--
"Teach people what you know."
.............................................................................