Magento 2.2 - Mobile_detect is not workingMagento2 apache rewrites not working on localRequirejs shim option not workingMagento 2 Active Mobile Menu width calc() issue being doubledjQuery css is not working for mobileMagento 2: setPageSize not working in blockHow to set 2 different themes for Mobile and Desktop in Magento 2.1.7 without changing the core fileObserver and event not workingMagento 2: Desktop css is loading while mobile css not loadingCron jobs not workingHow to use require_once in magento 2
Is there a RAID 0 Equivalent for RAM?
Does grappling negate Mirror Image?
Is it allowed to activate the ability of multiple planeswalkers in a single turn?
Why do Radio Buttons not fill the entire outer circle?
Temporarily disable WLAN internet access for children, but allow it for adults
What does "Scientists rise up against statistical significance" mean? (Comment in Nature)
Is it ethical to recieve stipend after publishing enough papers?
Change the color of a single dot in `ddot` symbol
What (the heck) is a Super Worm Equinox Moon?
15% tax on $7.5k earnings. Is that right?
How to explain what's wrong with this application of the chain rule?
Quoting Keynes in a lecture
What features enable the Su-25 Frogfoot to operate with such a wide variety of fuels?
Isometries between spherical space forms
Permission on Database
What is Cash Advance APR?
Is there a nicer/politer/more positive alternative for "negates"?
The IT department bottlenecks progress, how should I handle this?
C++ copy constructor called at return
Why the "ls" command is showing the permissions of files in a FAT32 partition?
Circuit Analysis: Obtaining Close Loop OP - AMP Transfer function
How can I write humor as character trait?
Which Article Helped Get Rid of Technobabble in RPGs?
What is the English pronunciation of "pain au chocolat"?
Magento 2.2 - Mobile_detect is not working
Magento2 apache rewrites not working on localRequirejs shim option not workingMagento 2 Active Mobile Menu width calc() issue being doubledjQuery css is not working for mobileMagento 2: setPageSize not working in blockHow to set 2 different themes for Mobile and Desktop in Magento 2.1.7 without changing the core fileObserver and event not workingMagento 2: Desktop css is loading while mobile css not loadingCron jobs not workingHow to use require_once in magento 2
require_once($directory->getRoot().'/Mobile_Detect.php');
$deviceDetect = new Mobile_Detect;
if ($deviceDetect->isMobile())
echo "<script>alert('MOBILE');</script>";
else
echo "<script>alert('WEB');</script>";
Always in all the device we get only "WEB".
magento2 mobile-device
add a comment |
require_once($directory->getRoot().'/Mobile_Detect.php');
$deviceDetect = new Mobile_Detect;
if ($deviceDetect->isMobile())
echo "<script>alert('MOBILE');</script>";
else
echo "<script>alert('WEB');</script>";
Always in all the device we get only "WEB".
magento2 mobile-device
add a comment |
require_once($directory->getRoot().'/Mobile_Detect.php');
$deviceDetect = new Mobile_Detect;
if ($deviceDetect->isMobile())
echo "<script>alert('MOBILE');</script>";
else
echo "<script>alert('WEB');</script>";
Always in all the device we get only "WEB".
magento2 mobile-device
require_once($directory->getRoot().'/Mobile_Detect.php');
$deviceDetect = new Mobile_Detect;
if ($deviceDetect->isMobile())
echo "<script>alert('MOBILE');</script>";
else
echo "<script>alert('WEB');</script>";
Always in all the device we get only "WEB".
magento2 mobile-device
magento2 mobile-device
asked yesterday
AmyAmy
3279
3279
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Add a function in any helper:
public function isMobile()phone
Then call this helper in your file:
if($this->helper('VendorModuleHelperData')->isMobile())
//Do mobile code
Thanks Shoaib, will check your answer and let you know.
– Amy
11 hours ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266729%2fmagento-2-2-mobile-detect-is-not-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Add a function in any helper:
public function isMobile()phone
Then call this helper in your file:
if($this->helper('VendorModuleHelperData')->isMobile())
//Do mobile code
Thanks Shoaib, will check your answer and let you know.
– Amy
11 hours ago
add a comment |
Add a function in any helper:
public function isMobile()phone
Then call this helper in your file:
if($this->helper('VendorModuleHelperData')->isMobile())
//Do mobile code
Thanks Shoaib, will check your answer and let you know.
– Amy
11 hours ago
add a comment |
Add a function in any helper:
public function isMobile()phone
Then call this helper in your file:
if($this->helper('VendorModuleHelperData')->isMobile())
//Do mobile code
Add a function in any helper:
public function isMobile()phone
Then call this helper in your file:
if($this->helper('VendorModuleHelperData')->isMobile())
//Do mobile code
edited 18 hours ago
answered yesterday
Shoaib MunirShoaib Munir
2,1911828
2,1911828
Thanks Shoaib, will check your answer and let you know.
– Amy
11 hours ago
add a comment |
Thanks Shoaib, will check your answer and let you know.
– Amy
11 hours ago
Thanks Shoaib, will check your answer and let you know.
– Amy
11 hours ago
Thanks Shoaib, will check your answer and let you know.
– Amy
11 hours ago
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266729%2fmagento-2-2-mobile-detect-is-not-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown