Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Can Metronic Identify the device?


I need to identify the device from which the user visits us, so I was wondering if Metronic has something already established that allows me to identify if the user is using the application from a computer or from a mobile phone?

Thanks for the help, I'll stay tuned.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


Hi,

Sorry for the late reply.

If you want to change styles based on the screen size then you can use CSS media query.

/* Base styles */
body {
font-family: Arial, sans-serif;
background-color: white;
color: black;
}

/* Styles for screens wider than 600px */
@media (min-width: 600px) {
body {
background-color: lightblue;
color: darkblue;
}
}

/* Styles for screens wider than 900px */
@media (min-width: 900px) {
body {
background-color: lightgreen;
color: darkgreen;
}
}

/* Styles for screens narrower than 400px */
@media (max-width: 400px) {
body {
background-color: lightcoral;
color: darkred;
}
}


If you want to detect screen size in your component then you can use the code below:

const screenWidth = ref(window.innerWidth);
const screenHeight = ref(window.innerHeight);

const updateScreenSize = () => {
screenWidth.value = window.innerWidth;
screenHeight.value = window.innerHeight;
};

onMounted(() => {
window.addEventListener("resize", updateScreenSize);
});

onUnmounted(() => {
window.removeEventListener("resize", updateScreenSize);
});


Regards,
Lauris Stepanovs,
Keenthemes Support Team


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(