viewport = device width for google.com

Very useful for those who use google.com with user agent of old browsers

  1. // ==UserScript==
  2. // @name viewport = device width for google.com
  3. // @namespace http://example.com/viewport-for-google
  4. // @match https://www.google.com/search?*tbm=isch*
  5. // @run-at document-start
  6. // @grant none
  7. // @version 0.1
  8. // @author Rishabh
  9. // @description Very useful for those who use google.com with user agent of old browsers
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. const tag = document.createElement('meta');
  15. tag.setAttribute("name", "viewport");
  16. tag.setAttribute("content", "width=device-width, initial-scale=1");
  17.  
  18. function insertMetaTag() {
  19. if (!document.head.contains(tag)) {
  20. document.head.appendChild(tag);
  21. }
  22. }
  23.  
  24. if (document.head) {
  25. insertMetaTag();
  26. } else {
  27. document.addEventListener("DOMContentLoaded", insertMetaTag);
  28. }
  29. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址