記事ディレクトリ
- が埋め込まれているかどうかは、
url
の検索パラメータ (新しいパラメータ など) によって判断できます。embed
<iframe
src="https://test.com/#/main?id=66"
width="100%"
height="100%"
frameBorder={0}
/>
<iframe
src="https://test.com/?embed=csdn#/main?id=66"
width="100%"
height="100%"
frameBorder={0}
/>
- 埋め込みプロジェクトのパラメータを受け入れ
embed
、それに応じて判断して使用します
export function isEmbed() {
const usp = new URLSearchParams(window.location.search);
return usp.has('embed');
}
export function getEmbed() {
const usp = new URLSearchParams(window.location.search);
return usp.get('embed');
}