override-property-read

The override-property-read snippet overrides a property's value on the window object with a set of available properties.

You can use the override-property-read snippet to change the value of global properties.

Parameters

Name
Description
Mandatory

property

The name of the property or the path to that property. If the property is a direct child of window, this parameter will be just the property name. But, if you want to access a sub property, this parameter will be a chain of properties separated by dots.

Yes

value

The value to override the property with.

Yes

setConfigurable

Value of the configurable attribute of the [descriptor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty#description) of property. If this parameter is not used it defaults to true. Setting it to false will prevent the property set and get being overwritten or otherwise changed by anybody (including us). If this snippet doesn't work as expected when passing only the property and the value, it could mean that the website is circumventing and setting this parameter to false can come in handy.

No

Possible override values

Possible values to override the property with:

Value
Definition

undefined

false

true

null

noopFunc

function with an empty body

trueFunc

function that returns true

falseFunc

function returning false

" "

empty string

positive decimal integer

Filter examples

The following table lists examples that use the override-property-read snippet:

Filter
Result

override-property-read adConfig undefined

adConfig has the value of undefined.

override-property-read adConfig undefined false

adConfig has the value of undefined and it is no longer configurable.

override-property-read shouldShowAds falseFunc

shouldShowAds has the value of a function that returns false when called.

override-property-read config.adCount 0

config.adCount has the value of 0.

Debugging

The following table contains messages you'll find useful during debugging:

Message
When the message occurs
Definition

<<property>> override done

Each time the property is read

The property is accessed.

Overrding <<property>> FILTER: override-property-read <<param>>

Right before attaching to the property

This log is printed just before the snippet takes over the property getter, along with the filter that successfully overrode the property (the parameters will be individually wrapped in single quotes).

Last updated