Answer the question
In order to leave comments, you need to log in
How can I make the page accessible only through the mobile application?
There is a site on the YII engine, there is a mobile application. There are pages - which we need to show only in the mobile application. For example, for the /index/index pages to be opened through the application, and if through a browser on a PC or phone, then redirect or any other solution.
Answer the question
In order to leave comments, you need to log in
There is such a Mobile-Detect thing and even a Yii2 extension for it
var userDeviceArray = [
{device: 'Android', platform: /Android/},
{device: 'iPhone', platform: /iPhone/},
{device: 'iPad', platform: /iPad/},
{device: 'Symbian', platform: /Symbian/},
{device: 'Windows Phone', platform: /Windows Phone/},
{device: 'Tablet OS', platform: /Tablet OS/},
{device: 'Linux', platform: /Linux/},
{device: 'Windows', platform: /Windows NT/},
{device: 'Macintosh', platform: /Macintosh/}
];
var platform = navigator.userAgent;
function getPlatform() {
for (var i in userDeviceArray) {
if (userDeviceArray[i].platform.test(platform)) {
return userDeviceArray[i].device;
}
}
return 'Неизвестная платформа!' + platform;
}
console.log('Ваша платформа: ' + getPlatform());
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question