Issue
Hello to all the community, I have a question: is it possible in blade laravel to apply a condition to the meta name="viewport" content="width=device-width, initial-scale=0.4"?
I would like the scale to start from 0.4 for smartphones, for tablets from 0.6, is it possible to do this? if so how? thanks so much to the whole community..
<meta name="viewport" content="width=device-width, initial-scale=0.4">
Solution
try using the library https://github.com/serbanghita/Mobile-Detect
class AppServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->singleton('mobile-detect', function ($app) {
return new MobileDetect();
});
}
}
Blade
@if (app('mobile-detect')->isMobile())
<meta name="viewport" content="width=device-width, initial-scale=0.4">
@elseif (app('mobile-detect')->isTablet())
// TODO
@endif
```
Answered By - Denis Sinyukov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.