Thông báo: Nhận các tin tức mới nhất từ NewTricks Đăng kí ngay

Cách xóa bỏ "?m=1" trên URL Blogspot

Estimated read time: 3 min

  

Khi bạn vào một trang web (nền tảng blogger) nào đó trên mobile thì hãy để ý trên thanh địa chỉ nó sẽ có thêm đoạn ?m=1, có bao giờ bạn nghĩ trong đầu làm thế nào để xóa dòng chữ này chưa? Hôm nay Đức sẽ chia sẻ cho bạn thủ thuật replace ?m=1 trên thanh địa chỉ Blogspot mobile, giúp blog của bạn hiển thị một cách chuyên nghiệp hơn mà không ảnh hưởng gì tới SEO.

Các bước thực hiện:

Bước 1: Đầu tiên bạn vào trang quản trị Blogger ➤ Chủ đề ➤ Chỉnh sửa HTML.

Bước 2: Copy đoạn js phía dưới

<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>

Bước 3: Dán toàn bộ code đã copy phía trên vào trước thẻ đóng </head>

Bước 4: Lưu lại là xong rồi !

Nguồn: code.pro.vn

Getting Info...

About Author

Life is a collection of messages

1 nhận xét

  1. second ago
    Bài viết rất hay

Ads by Google