Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jingjingxyk opened this issue Dec 29, 2022 · 0 comments
Open

Comments

@jingjingxyk
Copy link
Contributor

jingjingxyk commented Dec 29, 2022

实现本功能,需要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"
      ]
    }
  }
]

规则文件

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant