Advertisement

Easiest Way To Remove '?m=1' in Blogger Blog URL

When we use blogger for our website, there is a URL parameter "?m=1" which always shows beside website URL whenever it is opened in a mobile device.

In this article we are going to learn an easiest way to remove "?m=1" in blogger blog URL. This process is very simple, you just have to add the given code to your blogger's HTML/JavaScript widget.

Easiest Way To Remove '?m=1' in Blogger Blog URL

Code To Remove '?m=1' in Blogger Blog URL

Do you want to remove "?m=1" from your blogger blog URL so that whenever your website is opened in a mobile device, it doesn't show URL parameter "?m=1" beside every URL opened in that device.

Then follow the steps below and add the given JavaScript code into your website's HTML section.

JavaScript Code:
<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>

Steps To Implement HTML/JavaScript Code in Blogger

Step 1:

Go to "Layout" section of blogger and click on "Add a Gadget" as shown in image below.

Step 1: Easily Disable Copy/Paste and Right Click in Blogger Blog

Step 2:

Now select "HTML/JavaScript" gadget in list of all blogger gadgets as shown in image below.

Step 2: Easily Disable Copy/Paste and Right Click in Blogger Blog

Step 3:

After "HTML/JavaScript" gadget opens, paste the given code to remove '?m=1' from blogger blog URL in Content section of that gadget.

Step 3: Easily Disable Copy/Paste and Right Click in Blogger Blog

Step 4:

After pasting the given code in Content section of the blogger "HTML/JavaScript" gadget, click on Save as shown in above image. And DONE!

Now whenever your website is opened in a mobile device, it will show your website without '?m=1' URL parameter of Blogger blog.

Conclusion: I hope this article will help you to easily remove '?m=1' parameter in your blogger blog URL.

Post a Comment

0 Comments