Share code xóa bỏ ?m=1 khi truy cập blogspot trên trình duyệt điện thoại di động

Hello! Lại là 1 chuyên mục share code tiếp đây. Anh em làm blogspot đã bao giờ cảm thấy Bực mình khi truy cập trang blog của mình trên điện di động toàn hiển thi ra "?m=1" không? Mình thì rồi, url đang đẹp thì đùng phát hiện ?m=1 trông nó xấu hẳn. Nay mình sẽ share code xóa ?m=1 khỏi url của ae nhé. Cách này chỉ ẩn ?m=1 để blog trang web anh em tối ưu seo thôi. NÓ KHÔNG ẢNH HƯỞNG gì đến seo trang web anh em nên yên tâm khi sử dụng nhé. Như thường lệ, mọi người nhớ share và comment bài viết của mình để có động lực share tiếp cho anh em nhé

Share code xóa bỏ ?m=1 khi truy cập blogspot trên trình duyệt điện thoại di động
Share code xóa bỏ ?m=1 khi truy cập blogspot trên trình duyệt điện thoại di động

Share code xóa bỏ ?m=1 khi truy cập blogspot trên trình duyệt điện thoại di động

Dưới đây là code xóa bỏ ?m=1 khi truy cập blogspot trên trình duyệt điện thoại di động, các bạn chỉ cần copy vào bất cứ đâu trong mã html trang web là được


<script>
    //<![CDATA[
      var url = window.location.href
      var uri = window.location.toString()
      var fb1 = url.substring(0, url.indexOf('?fbclid'))
      var fb2 = url.substring(0, url.indexOf('&fbclid'))
      var gi1 = url.substring(0, url.indexOf("?gidzl"))
      var gi2 = url.substring(0, url.indexOf("&gidzl"))
      var m1 = url.substring(0, url.indexOf('?m=1'))
      var m2 = url.substring(0, url.indexOf('&m=1'))
      if ((uri.length - fb1.length) > 0) window.history.replaceState({}, document.title, fb1)
      if ((uri.length - fb2.length) > 0) window.history.replaceState({}, document.title, fb2)
      if ((uri.length - gi1.length) > 0) window.history.replaceState({}, document.title, gi1)
      if ((uri.length - gi2.length) > 0) window.history.replaceState({}, document.title, gi2)
      if ((uri.length - m1.length) > 0) window.history.replaceState({}, document.title, m1)
      if ((uri.length - m2.length) > 0) window.history.replaceState({}, document.title, m2)
    //]]>
  </script>

Lời kết

Trên đây là mình Share code xóa bỏ ?m=1 khi truy cập blogspot trên trình duyệt điện thoại di động. Chúc các bạn một ngày học tập và làm việc thật hiệu quả. Xin chào và hẹn gặp lại!

Copyright © Trick Pro

Content Creator, Graphic Designer, UI / UX Designer