BarcodeDetector()

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (HTTPS) でのみ利用できます。

Invalid slug for templ/sidebar: Barcode Detector API

Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。

BarcodeDetector() コンストラクターは、線形および二次元バーコードを画像から検出する新しい BarcodeDetector (検出器)オブジェクトを生成します。

構文

js
new BarcodeDetector();

引数

barcodeDetectorOptions 省略可

後続の detect() 呼び出しで検索する一連の BarcodeFormats を含むオプションオブジェクトです。オプションは以下の通りです。

この例では、対応している形式を指定して新しいバーコード検出器オブジェクトを作成し、ブラウザーの互換性をテストしています。

js
// 新しい検出器を生成
var barcodeDetector = new BarcodeDetector({
  formats: ["code_39", "codabar", "ean_13"],
});

// 互換性のチェック
if (barcodeDetector) {
  console.log("Barcode Detector に対応しています。");
} else {
  console.log("Barcode Detector はこのブラウザーでは対応していません。");
}

仕様書

Specification
Accelerated Shape Detection in Images
# dom-barcodedetector-barcodedetector

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
BarcodeDetector() constructor
Experimental

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.
User must explicitly enable this feature.
Has more compatibility info.