$.ajax({
method: 'GET', // "GET", "POST", "PUT"
dataType: 'json',
url: 'https://example.com/',
headers: {},
cache: false
}).done(function(data){
console.log(data);
}).fail(function(jqXHR,status,errorThrown){
if(jqXHR.status===500 && jqXHR.responseText){
console.err(jqXHR.responseText);
}
}).always(function(data){
console.log(data);
});
var request = new XMLHttpRequest();
request.open('GET', 'https://example.com/', true);
request.onload = function() {
if (this.status >= 200 && this.status < 400) {
// Success!
var data = JSON.parse(this.response);
} else {
// We reached our target server, but it returned an error
}
};
request.onerror = function() {
// There was a connection error of some sort
};
request.send();
fetch(
'https://example.com/',
{
method: 'get', // GET, POST
headers: {
'content-type': 'application/json'
},
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
mode: 'cors', // no-cors, cors, *same-origin
}
).then((response) => {
if (!response.ok) {
throw new Error('HTTP error, status = ' + response.status);
}
return response.json();
}).then((myJson) => {
console.log(myJson);
}).catch((error) => {
console.log('Error: ' + error.message);
});
fetch('https://www.google.com')
.then((response) => {
console.log(response.status);
return response.json();
})
.then((json) => {
console.log(json);
})
.catch((error) => {
console.log(error);
})
.finally(() => {
document.querySelector('#spinner').style.display = 'none';
});
js
手機推流 --> nginx rtmp server --> OBS拉流 --> OBS推到實況平台 nginx.conf worker_processes 1; error_log logs/rtmp_error.log debug; events { worker_connections 1024; }
Sep 14, 2022Content Security Policy (CSP) 內容安全政策 Content Security Policy是寫給瀏覽器看的 他寫在從伺服端回應給使用者瀏覽器端網頁的HTTP Header裡 主要用來限制網頁中對外部的請求來源(例如:css,js(ajax,ws),webfont,img,video,iframe等等) 還有一部份是禁止HTML行內的JS或CSS運作 以及限制<form>表單的指向網址 過濾XSS語法是伺服器端語言的工作(例如PHP) 如果不幸過濾失敗的話CSP的功能可以阻止惡意語法在瀏覽器端運作
Nov 3, 2021綜合 全球 Google Maps OpenStreetMap - 開源開放編輯的地圖 Bing Maps (Microsoft) 台灣 gov
Jul 1, 2021這裡是浪Play直播(舊名:金剛kingkong直播)聊天室截取工具 :banana: BABANANA Chat :banana: 的說明文件。 這個聊天室頁面可使用==OBS擷取==或是==網頁瀏覽器直接觀看==,細節請觀看下方說明。 :::info 如果有更新改版,更新訊息都會寫在這個說明頁面。 使用上只要重新整理網頁就能更新。 註: OBS的網頁暫存檔(cache)有時候會卡比較久,要多重新整理幾次才會正常更新。 ::: :fries: 說明文件 / 教學 使用網址:
Jun 18, 2020or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up