How to remove ?m=1, ?m=0, %3D, in Blogger Website Url

The ?m=1 code is a code that indicates that the website address is accessed via a smartphone device.
The ?m=1 code is a code that indicates that the website address is accessed via a smartphone device.

Blogger Template - The ?m=1 code is a code that indicates that the website address is accessed via a smartphone device. We can remove these codes using the script I provide below.

<script>
//<![CDATA[
var tLink = window.location.href;
tLink = tLink.replace("?m=0", "");
tLink = tLink.replace("%3D", "");
tLink = tLink.replace("%3D%3D", "");
tLink = tLink.replace("&m=1", "")
tLink = tLink.replace("?m=1", "");
tLink = tLink.replace("&m=0", "");
window.history.replaceState({}, document.title, tLink);
//]]>
<script>

It appears that the above script works to remove some of the code contained in the url suffix, namely ?m=1, ?m=0, & m=1, & m=0, and %3D. This code often makes our website not SEO in Google Search Enggine.

How to Install Script

For installation on blogger or on your website, please follow these guidelines:

  • Please open your blogger dashboard.
  • Select 'Themes' then select 'Edit HTML'.
  • Then find the code '</body>' and make sure the script is right above it.
  • Then select 'Save Theme'.
  • Done.

How the Script Works

First, this script will take the url address from the address bar using the window.location.href function and store it in the tLink variable.

var tLink = window.location.href;

Furthermore, the url that has been taken earlier will be renamed or replace the url by using the replace () function. Here I changed the url name 6 times:

tLink = tLink.replace("?m=0", "");
tLink = tLink.replace("%3D", "");
tLink = tLink.replace("%3D%3D", "");
tLink = tLink.replace("&m=1", "")
tLink = tLink.replace("?m=1", "");
tLink = tLink.replace("&m=0", "");

After that, the url that has been replaced will be returned to the address bar using the following functions:

window.history.replaceState({}, document.title, tLink);

This script is written using pure javascript or Pure Javascript which means the script is written without the help of frameworks such as jquery and others. Up to here I hope you understand the workflow. If anyone wants to ask, please comment below. Thanks for visiting.