Skip to content

功能使用三: 通过检测窗口大小来设置浏览器 UA #137

Open

Description

@jingjingxyk

实现本功能,需要content_scripts配置,content_scripts 配置例子

起因:FirefoxBar/HeaderEditor#216

规则例子:

[
  {
    "id": 1,
    "priority": 2,
    "action": {
      "type": "modifyHeaders",
      "requestHeaders": [
        {
          "header": "user-agent",
          "operation": "set",
          "value": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"
        }
      ]
    },
    "condition": {
      "urlFilter": "https://www.jingjingxyk.com/?spm=1",
      "requestDomains": [
        "www.jingjingxyk.com"
      ],
      "resourceTypes": [
        "main_frame",
        "sub_frame",
        "stylesheet",
        "script",
        "image",
        "font",
        "object",
        "xmlhttprequest",
        "ping",
        "csp_report",
        "media",
        "websocket",
        "webtransport",
        "webbundle",
        "other"
      ]
    }
  },
  {
    "id": 2,
    "priority": 2,
    "action": {
      "type": "modifyHeaders",
      "requestHeaders": [
        {
          "header": "user-agent",
          "operation": "set",
          "value": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G955U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Mobile Safari/537.36"
        }
      ]
    },
    "condition": {
      "urlFilter": "https://www.jingjingxyk.com/?spm=2",
      "requestDomains": [
        "www.jingjingxyk.com"
      ],
      "resourceTypes": [
        "main_frame",
        "sub_frame",
        "stylesheet",
        "script",
        "image",
        "font",
        "object",
        "xmlhttprequest",
        "ping",
        "csp_report",
        "media",
        "websocket",
        "webtransport",
        "webbundle",
        "other"
      ]
    }
  }
]

规则文件

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions