简体   繁体   中英

find javascript changing HTML

First off, I'm not a developer, but a site owner running wordpress. my site has some Amazon affiliate URLS. What is happening is some rogue javascript is running and changing the referral ID's of the HTML code only from a google search specifically (If I load a page directly the HTML doesn't change). Basically I'm trying to figure out how to locate it, I figure that by looking at the html section I can trace what javascript is changing the HTML? With that information maybe I can help find it or pass that on to the hosting company to remove the file.

For example: in the website shows: https://amazon.com/49684095/?tag=properamazontag the javascript runs and changes to: https://amazon.com/49684095/?tag=douchebagscammercode

I hope it makes sense.

I have disabled javascript in the browser and confirm that the HTML code doesn't change, so I know it's a javascript issue.

For anyone looking at this with the same issue, what I did was follow this thread Find javascript that is changing DOM element . I went through all the JS changes looking for odd code not associated with a plugin file or theme.

once I found the code, I used a plugin called string locator and searched "everything under WP-content" for the first part of the bad code. From the plugin shows the location of the code (a JS file was added to the theme template) and I then used the same technique to search for the names JS file (in this case called theme.js) and found a php line in the functions.php file that had to be deleted along with the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM