How to override window.location in Firefox?
Asked Answered
H

1

2

I am trying to override the window.location in Firefox, through the following code and keep getting an error (actually want to prevent the default behavior, but I think that's not relevant) :

    Code : 
    window.__defineGetter__('location', function() {});

    Error
    redeclaration of var location

I started with the suggestions at Programatically disable window.location.reload?, but didn't work.

Thanks in advance, Sunil

Hunsinger answered 2/11, 2011 at 18:59 Comment(0)
N
4

The location property of Window is non-configurable for security reasons, because some broken things out in the wild base security checks on the value of window.location.toString(), so you can't do this.

Naturalize answered 3/11, 2011 at 5:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.