每当我运行代码时,我一直收到错误,如果有人能解释什么是错误或给我看一个固定的版本?我将非常感激
混合内容:
' https://www.roblox.com/catalog/'是通过HTTPS加载的, 但是请求了一个不安全的XMLHttpRequest端点 ' http://c3.rbxcdn.com/4b192cd410398472f25d7aea541a352c&#39 ;.这个请求 已被封锁;内容必须通过HTTPS提供。
代码:
var globeid = 0
var priceUnder = 5000
function check(z){
$.get(z, function(data){
if ($(data).find('#ctl00_cphRoblox_LimitedEditionRemaining').length) {
var check = $(data).find('#BuyWithRobux').children('div').data()
var Token = data.match(/Roblox.XsrfToken.setToken([^)]+)/)[1].match(/[^(']+/)[0]
if (check['expectedPrice'] <= priceUnder) {
$.post('https://www.roblox.com/api/item.ashx?rqtype=purchase&productID=' + check["productId"] + '&expectedCurrency=1&expectedPrice=' + check["expectedPrice"] + '&expectedSellerID=1')
console.log('Purchased: ' + check["itemName"] + " | " + check["itemId"] + " for " + check["expectedPrice"])
}
}
})
}
function checkifnewlim() {
$.get("https://www.roblox.com/asset/?id=261522650").success(function(r) {
r = decodeURIComponent(r);
r = JSON.parse(r.substring(r.indexOf("{"), r.lastIndexOf("}") + 1));
var notifications = r
for (var info in notifications) {
var currid = notifications[info]["id"]
if (currid > globeid) {
console.log("NEW ITEM...")
globeid = currid
notificationpopup(notifications[info])
var nn = notifications[info]
var url = nn.url.split('&')[0]
check(url)
}
}
})
function notificationpopup(n) {
var notification = new Notification(n.lite, {
icon: n.icon,
body: n.header + "\n" + "Price: " + n.items.Price + "\n\n" + "Autobuy: OFF"
});
var url = n.url.split('&')[0]
notification.onclick = function() {
console.log("NOTIFICATION SUCCESS!");
window.open(url);
}
}
}
setInterval(function() {
checkifnewlim()
}, 100)
答案 0 :(得分:0)
如果您的代码在HTTPS页面上运行,则您只能从其他域请求HTTPS内容,任何尝试与HTTP资源通信的xhr请求都将被浏览器阻止。如果您尝试访问的内容位于您的域中,请确保它通过HTTPS提供。否则你可以做以下两件事之一: