Building Chrome extension using xpath and Cross-Origin XMLHttpRequest
问题 I'm currently trying to build my first Chrome extension but I'm having a slight issue with my code. I want to use XMLHTTPRequest and xpath to display a specific number from an external website as a badge on my icon. The code I'm using in my background.js file is as follows: var xhr = new XMLHttpRequest(); xhr.open("GET", "http://www.example.com", true); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { // innerText does not let the attacker inject HTML elements. document