1. Using metatag module
If you want to do it without custom coding you can try metatag module
2. Using viewport module
There is also a dedicated module called viewport which will allow you to do just that.
3. In your custom theme
But can be easily done in your custom theme. Put the following code inside the THEMENAME_preprocess_html
function in your THEMENAME.theme
function THEMENAME_preprocess_html(&$variables) {
$viewport = [
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => [
'name' => 'viewport',
'content' => 'width=device-width, user-scalable=no',
],
];
$variables['page']['#attached']['html_head'][] = [$viewport, 'viewport'];
}
NOTE: if THEMENAME_preprocess_html
function does not exist you can create it and put the code inside. You can't redeclare it otherwise you will end up with WSOD.
function THEMENAME_preprocess_html(&$variables) {
//...
}