How to remove '?m=1' in Blogger?
Hello guys!, Welcome to Blogging Zero. BloggingZero.in is the best website for Bloggers to get unique Blogging Tips & Tricks, Blogger Templates, Widgets, SEO, HTML tips, and affiliate marketing. Today we will know how to solve ?m=1 problem in the blogger URL.
It is very simple process to fix this "?m=1" problem in the Blogger. In this article, I will show you - How you get rid of this ?m=1 issue. So read this post carefully or otherwise you do mistakes in simple coding.
As you have noticed Blogger shows this '?m=1' in your website's URL when someone visits your sites through mobile or in mobile mode.
Why Blogger shows ?m=1 in Mobile URLs?
Earlier most of the Blogger themes does not use the responsive design, most themes show different version for Desktop and Mobile users. So to identify the device properly, blogger introduces the concept of ?m=1 parameter in the blogger URL. So, whenever someone visits your website from Mobile or tablet, it will show a URL structure like this- https://www.bloggingzero.in/?m=1
Currently, there is no permanent fix to this problem. But you can display a clean URL to the visitors when they visits your site through a mobile device. So, let us check how you can fix this ?m=1 problem in Blogger.
How to remove ?m=1 in Blogger -
To remove this ?m=1 from Blogger's URL follow the below steps-
Step-1: First of all, Go to Blogger Dashboard.
Step-2: Click on the theme.
Step-3: After that go to the Edit HTML option from the drop-down menu.
Step-4: Now you have to add the below Script just before the </body> tag-
Step-5: Now Click on the save button and ?m=1 will get removed from the Blogger site for Mobile users.
<script type='text/javascript'>
//<![CDATA[
var uri = window.location.toString();
if (uri.indexOf("%3D","%3D") > 0) {
var clean_uri = uri.substring(0, uri.indexOf("%3D"));
window.history.replaceState({}, document.title, clean_uri);
}
var uri = window.location.toString();
if (uri.indexOf("%3D%3D","%3D%3D") > 0) {
var clean_uri = uri.substring(0, uri.indexOf("%3D%3D"));
window.history.replaceState({}, document.title, clean_uri);
}
var uri = window.location.toString();
if (uri.indexOf("&m=1","&m=1") > 0) {
var clean_uri = uri.substring(0, uri.indexOf("&m=1"));
window.history.replaceState({}, document.title, clean_uri);
}
var uri = window.location.toString();
if (uri.indexOf("?m=1","?m=1") > 0) {
var clean_uri = uri.substring(0, uri.indexOf("?m=1"));
window.history.replaceState({}, document.title, clean_uri);
}
//]]>
</script>