HTML5 中是否存在跨域屬性?


是的,官方規範將跨域屬性規定為

The crossorigin attribute is a CORS settings attribute. Its purpose is to allow
images from third-party sites that allow cross-origin access to be used with canvas.

你可以使用它來解決 JavaScript 錯誤,例如記錄 js 錯誤

if (securityOrigin()->canRequest(targetUrl)) {
   msg = myErroe;
   line = myLineNumber;
   source = sourceURL;
} else {
   msg = "Error!";
   source = String();
   line = 0;
}

更新於: 2020-01-29

163 瀏覽量

開啟您的 職業生涯

透過完成課程獲得認證

開始
廣告
© . All rights reserved.