Closed shokai closed 8 years ago
import axios from "axios";
(async() => {
const res = await axios.head("http://shokai.org");
console.log(res.status);
console.log(res.headers["content-type"]);
})();
クライアント側で実行するのはCORS的に当然無理
とりあえずimgタグとaタグ両方描画して、imgのonloadがイベントが来たらaタグを消すのはどうか? imgは最初非表示でtagを作る
spread operatorでattrsに入れたkeyを渡そうとすると <EmbedURL src="http~~~~" {...attrs} />
Warning: Element:
key
is not a prop. Trying to access it will result inundefined
being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://fb.me/react-special-props)
とりあえず一度content-typeが判明したURLはURLのmd5-hashをkeyとしてlocalStorageに保存しておきたい。 以後それを参照する。
クライアントのimgタグでcontent-type判定してlocalStorageに保存してサーバーにsocket.ioで送ってDBに保存しておいてサーバーサイドレンダリング時に使うという実装ができたけどこれはなんかおかしい
ふつうにサーバーがcontent-typeのリスト持ってればいい
面倒だからいいや
末尾が.jpg等じゃない画像を埋め込んだりしたい。 https://avatars.githubusercontent.com/u/34204?v=3&s=20 など、拡張子がないけど画像を返すURLが増えてきている。
サーバー側に対応表を持たせる。
サーバーからアクセスできない(パスワードがかかっている等)URLをクライアントに代わりに調べてもらうのは・・無理そう?