LoginSignup
1
1

More than 5 years have passed since last update.

IE9でcanvasでの画像合成する時の落とし穴回避法

Last updated at Posted at 2016-11-11

別ドメインのcrossOriginはサーバーで許可していても、img.crossOriginがあってもダメ

同じドメインに配置する必要がある

画像のcontent typeが application/octet-stream

(サーバーでの画像をブラウザで直接閲覧した際にダウンロードがいきなり走る設定の状態)
だと画像が取得出来ない

imageのonloadが走らない場合があるので

setInterval で回しながらwidthが入った時か、デカイ画像だとwidthに値が入っても読み込みがダメな時があるので、

if (0 < img.width && img.complete){
    // onload走ったのと同じ処理
}

で一安心

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1