simulating support for missing web apis?
Is there a way to simulate the lack of support for web apis in Firefox or Chrome?
Like for example, deactivating the push api so I can test if my fallback properly triggers.
I was hoping for a setting in
about:config
or something similar.
For example, I have this line of code:
In my browser, isSupported
is always true
because my browser supports the push api. But I want to test if this variable is actually really false
when support is missing.7 Replies
the easiest option is to test on a browser that doesnt support it
and the easiest is to just install windows 10, on some older version
or using one of those many websites that let you run your site on different browsers
That sounds very inflexible and too complex for this simple problem
Do you mean I should install win10 in a vm? That sounds even more complex 😅
well, you can try to nuke the value from window
like window.thingy = null
or undefined
windows 10 is pretty simple to install
I tried that. Doesnt really work. Most of these javascript global objects are getter only
And when it works then javascript still counts them as existent on the parent object
Therefore the clause
'xyz' in obj
doesnt work as intended anymore
delete obj
is straight up ignoredthen create a plain old js object
add the keys you want to it
pretend that thats the window object
test if the missing key is there
this way, you can toggle features on/off for testing
or just manually invert the logic
Misspell the strings
So just check for something that doesn't exist
Easier to make logical errors inverting logic
that works too