首页 > 解决方案 > 为什么 ym-faux-ad-iframe 被注入到我的 DOM 中?

问题描述

我有一个非常基本的骨架 React 项目设置。

使用 create-react-app 创建,使用 react-scripts-ts 支持打字稿。我已经添加了 redux 和 react-router。但是,我刚刚注意到有一个 iframe 在某个时候被注入到我的 DOM 中,我无法弄清楚它为什么或来自哪里。

它似乎是某种亚马逊广告 iframe。

这是浏览器发出的请求

curl 'https://s3.amazonaws.com/ym-hosting/faux-ad.htm?advertiserId=78946&brandName=faux' -H 'Connection: keep-alive' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' -H 'Referer: http://localhost:3000/' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.9' --compressed

已安装的依赖项

"dependencies": {
  "react": "^16.6.0",
  "react-dom": "^16.6.0",
  "react-redux": "^5.1.0",
  "react-router-dom": "^4.3.1",
  "react-scripts-ts": "3.1.0",
  "redux": "^4.0.1",
  "redux-logger": "^3.0.6",
  "redux-thunk": "^2.3.0"
},
"devDependencies": {
  "@types/jest": "^23.3.9",
  "@types/node": "^10.12.2",
  "@types/react": "^16.4.18",
  "@types/react-dom": "^16.0.9",
  "@types/react-redux": "^6.0.9",
  "@types/react-router-dom": "^4.3.1",
  "@types/redux": "^3.6.0",
  "@types/redux-devtools-extension": "^2.13.2",
  "@types/redux-logger": "^3.0.6",
  "@types/redux-thunk": "^2.1.0",
  "redux-devtools-extension": "^2.13.5",
  "typescript": "^3.1.6"
},

有没有其他人见过这样的事情?是不是某个模块悄悄地注入了它以从简单的广告浏览中获利?

截图:

网络工具 DOM

编辑:原来这与 React 或 create-react-app 无关,而是与浏览器扩展“HoverZoom”有关。

标签: google-chrome-extension

解决方案


我不认为这是一个 React 问题,我认为它一定是注入 iframe 的浏览器扩展。我最近开始开发自己的 Web 应用程序(在 ASP.NET Core 上使用 F#),昨天在我的应用程序的 DOM 中看到了同样的东西;你的问题是我用谷歌搜索时唯一出现的问题,所以我想检查其他网站,我去的任何地方似乎都有。

iframe 乍一看并没有恶意(它是圣达菲度假的虚假广告),但谁知道另一端是否有跟踪代码跟踪我们的动作。现在开始禁用扩展,直到我找到罪魁祸首......

编辑:似乎是悬停缩放?不确定你是否使用那个,但禁用它为我删除了 iframe,所以现在它永远消失了。


推荐阅读