首页 > 其他分享 >js hook RequestHeader

js hook RequestHeader

时间:2023-06-08 13:12:16浏览次数:41  
标签:XMLHttpRequest RequestHeader setRequestHeader js hook org keyToLocaleLowerCase

 

 

 

// ==UserScript==
// @name         xhr_setRequestHeader
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://ppzh.jd.com/octopusbrandweb/brand/view/search/rankLocationNew.html
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
  'use strict';
  let org = window.XMLHttpRequest.prototype.setRequestHeader;
  window.XMLHttpRequest.prototype.setRequestHeader = function(key,value){
    let keyToLocaleLowerCase = key.toLocaleLowerCase();
    console.log(keyToLocaleLowerCase, value)
    if(keyToLocaleLowerCase.indexOf('sign') !== -1){
      debugger;
    }
    return org.apply(this,arguments);
  }
})();

 

标签:XMLHttpRequest,RequestHeader,setRequestHeader,js,hook,org,keyToLocaleLowerCase
From: https://www.cnblogs.com/angdh/p/17465951.html

相关文章

  • docker启动node.js项目
    原文链接:https://www.cnblogs.com/yalong/p/17463847.html这里使用koa2做为演示项目,使用Dockerfile构建Docker镜像,项目Git地址:仓库地址安装Docker网上都有教程可以自行查找,这里演示的环境是在mac下进行的在node项目根目录下创建Dockerfile文件项目目录如下:Docke......
  • js 分页拆分数据
    splitData(data,pageSize,pageNum){ constresult=[]; constpageTotal=Math.ceil(data.length/pageSize);//计算总页数 //for(leti=0;i<pageTotal;i++){ //conststartIndex=i*pageSize;//计算本页数据的起始位置 //constendI......
  • go json、yaml解码
    func GetFoo(ctx context.Context) (*T, error) {  req, err := http.NewRequest("GET", "http://foo/t.json", nil)  if err != nil {    return nil, err  }  req = req.WithContext(ctx)  res, err := http.DefaultClient.Do(req)  if e......
  • 移动端预览PDF,pdf.js预览PDF文件流格式
     一开始使用了vue-pdf效果并不理想,满足不了要求还出现兼容问题,PDF.js似乎是一个完美的解决方案,号称兼容各种浏览器.快速且高效.界面按钮可以配置,而且也比原生iframe框架好看一些,但是一轮的使用下来,确确实实躺了不少的坑,特此记录一下全过程,希望以后使用的时候注意一点.以......
  • 使用THREEJS实现一个可调节档位、可摇头的电风扇
    夏天到了,用Three.js实现一个可以摇头和调节档位的电风扇。主要使用到Blender处理3D模型,用Vite+Typescript搭建项目框架。效果演示:一、处理模型1、从爱(bai)给(gei)网下载一个风扇的3D模型,在Blender中打开,给模型贴上图。2、拆解模型。将风扇模型拆解成按钮、底座、扇叶、头部......
  • JS 模拟 队列 结构
    Code:/***队列(基于动态数组)*@class*/varAQueue=(function(){/***栈容器*@type{DArray}*/letarr;/***@class*/class_AQueue{/***构造器*@constructor*@param{number}[capacity]*/con......
  • JS 中 使用 Uuid
    一、官方网站https://github.com/uuidjs/uuid二、安装uuidnpminstalluuid三、导入uuid注:官方文档里的示例只适用于服务端(nodejs),想在浏览器里使用,得换一种导入方法nodejs:import{v4asuuidv4}from'uuid';浏览器js:constuuidv4=require('uuid').v4;四、使用c......
  • Three.js系列-报错export ‘Geometry‘ (imported as ‘THREE‘) was not found in ‘
    今天遇到报错export'Geometry'(importedas'THREE')wasnotfoundin'three'port'Geometry'(importedas'THREE')wasnotfoundin'three'(possibleexports:ACESFilmicToneMapping,AddEquation,AddOpe......
  • TsVSJs之间的区别
    一、观察1.JS平常的数据类型letval;val=123;val="123";val=true;val=[1,3,5];注意点:由于JS是弱类型的,所以只要定义了一个变量,就可以往这个变量中存储任意类型的数据也正是因为如此,所以会给我们带来一个问题2.假设a是一个数组,b是一个数值functiontest......
  • 13_How to Deploy NodeJs app on Ubuntu in Production
     地址:https://www.codewithharry.com/blogpost/deploy-nodejs-app-on-ubuntu/ HowtodeployaNode.jsapplicationinproductionInthispost,wewillseehowtorunanddeployNodeJSappsinproduction.Followthestepsbelow:Step1-InstallNodejsLet�......