Detect support for @page with Vanilla JS

I need to determine whether a browser supports CSS’ @page rule or not…

I first thought that I may be able to do this easily with CSS’ @supports() rule. But my understanding now is that you cannot nest one rule in another and are only able to check the support of classic property/ value declarations.

Now I am trying to use vanilla JS to detect support:

if ('CSS' in window && CSS.supports('@page')) { ... } 

However, this always returns false regardless of browser support.

Does anyone know an alternative way that I can accurately test client support for CSS’ @page using vanilla JS?

TY.

Asked on July 16, 2020 in CSS.
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.