Site logo

Archived topic

How to activate zoom function ?

7 replies · Started by Gilles on February 2, 2023

Viewing posts 1–8 of 8

Hello,
When testing my site https://www.un-jardin-bio.com/ with PageSpeed Insights, I got a warning "The [user-scalable="no"] attribute is used in the <meta name="viewport"> element, or the [maximum-scale] attribute is less than 5." (see here: https://i.imgur.com/dmxbwru.jpeg).
If I understand correctly, this prevents the activation of the zoom.
I imagine it comes from the theme... But I don't see how to correct this, and therefore make zooming possible.
Thanks.

Hi there,

this is the default viewport meta tag that theme inserts:

<meta name="viewport" content="width=device-width, initial-scale=1">

Which is different to what you have.
We provide a filter hook to change that:

https://docs.generatepress.com/article/generate_meta_viewport/

Did you use that in a custom function?

Hi David,
Since I had this error message first (<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">), I added this code in functions.php of my child theme:
add_filter( 'generate_meta_viewport', function() {
return '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5" />';
} );
It didn't change anything...
I just deleted this code and I have this message again: "<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"> "
I don't understand where this can come from...

Ok, so thats correct the one that the theme adds.

BUT there is a second one in the head of your site, which looks like this:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">

Thats not coming from the Theme.
Try disabling plugins to see if one of those is adding it.

To check if its there. Right Click > Inspect to open the Browser Developers tools, and CTRL + F to open the search field and search for: viewport

Your site shows there are 4 instances. You can ignore the 3rd and 4th ones as they are in an iFrame.

Ok, I found the 2 plugins possibly responsable of that... I will see that with them.
Thanks

Let us know how you get on

Following your advice, I found the plugin that was causing the problem...
It was PDF Embedder Premium, for which I had disabled zoom... I unchecked the relevant box. And the warning disappeared.
Thanks

Glad to hear that ! and thanks for lettings us know, as others may find this useful :)

This archived topic is closed to new replies.