Lorem ipsum dolor sit amet, consectetur adipiscing elit. Test link

Hướng dẫn xóa m=1 khi truy cập trên điện thoại

Blogspot mặc định khi chúng ta truy cập trên điện thoại thì tự động thêm ?m=1 vào phía sau đường dẫn (link), thủ thuật này mình hướng dẫn cách loại bỏ m=1 ngay trên link khi truy cập bằng thiết bị di động.

Hướng dẫn xóa m=1 khi truy cập trên điện thoại



Cách làm đơn giản là các bạn copy đoạn code dưới dán trước thẻ đóng </head> hoặc trước </body> đều được.


<script>
  //<![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>

Post a Comment