GM_xmlhttpRequest
のonload
で得た変数を外に持って行くにはどうすれば良いでしょうか?
var GetPageList = document.querySelectorAll('a[href*="http://www.example.net/"]');
for (var i = 0; i < GetPageList.length; i++) {
var GetPageLink = GetPageList[i].href;
GM_xmlhttpRequest({
method: "GET",
url: GetPageLink,
onload: function(response) {
var responseXML = null;
responseXML = new DOMParser().parseFromString(response.responseText, "text/html");
var GetTargetLink1 = response.responseText.replace(/\r?\n/g, "");
var GetTargetLink2 = GetTargetLink1.replace(/^.*<a href=\"([^"]*)\">More information...<\/a>.*$/g, "$1");
}
});
// ここで変数を読み込みたい
console.log(GetTargetLink2)
}