javascript - Mobile Redirect using Resolution
Get the solution ↓↓↓I have 2 page index.php (For Desktop) and indexm.php (For Mobile). I want to redirect it with detection of screen resolution size. I'm trying this code
<script type="text/javascript">
if (screen.width <= 720) {
window.location = "indexm.php";
} else {
window.location = "index.php";
}
</script>
and i am trying same in PHP,
<?php
if (screen.width <= 720) {
include "indexm.php";
} else {
include "index.php";
}
?>
But both the code is not working, Please help me with PHP or JavaScript code to make it work.
Answer
Solution:
For JavaScript:
changewindow.location
towindow.location.href = ('indexm.php');
For php I think using header is the best:
header('Location: indexm.php');
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: uncaught mysqli_sql_exception
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.