<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blazor Archives - 어제와 내일의 나 그 사이의 이야기</title>
	<atom:link href="https://lycos7560.com/category/c/blazor/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>생각의 흐름을 타고 다니며 만드는 블로그</description>
	<lastBuildDate>Mon, 04 Aug 2025 12:42:32 +0000</lastBuildDate>
	<language>ko-KR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://lycos7560.com/wp-content/uploads/2022/11/cropped-cropped-cropped-log-1-150x150-1-80x80.png</url>
	<title>Blazor Archives - 어제와 내일의 나 그 사이의 이야기</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>HTML iframe 정리</title>
		<link>https://lycos7560.com/etc/html-iframe-%ec%a0%95%eb%a6%ac/40225/</link>
					<comments>https://lycos7560.com/etc/html-iframe-%ec%a0%95%eb%a6%ac/40225/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Mon, 04 Aug 2025 12:42:26 +0000</pubDate>
				<category><![CDATA[Blazor]]></category>
		<category><![CDATA[기타]]></category>
		<category><![CDATA[a11y]]></category>
		<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[allow]]></category>
		<category><![CDATA[allow-forms]]></category>
		<category><![CDATA[allow-popups]]></category>
		<category><![CDATA[allow-same-origin]]></category>
		<category><![CDATA[allow-scripts]]></category>
		<category><![CDATA[allowfullscreen]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Aspect Ratio]]></category>
		<category><![CDATA[autoplay]]></category>
		<category><![CDATA[Browser]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[Clickjacking]]></category>
		<category><![CDATA[compatibility]]></category>
		<category><![CDATA[Content Security Policy]]></category>
		<category><![CDATA[CORS]]></category>
		<category><![CDATA[cross-origin]]></category>
		<category><![CDATA[CSP]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[DevTools]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[embed]]></category>
		<category><![CDATA[embed 태그]]></category>
		<category><![CDATA[Frame]]></category>
		<category><![CDATA[Frontend]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[height]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[HTML기초]]></category>
		<category><![CDATA[HTML태그]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[iframe 통신]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[lazy loading]]></category>
		<category><![CDATA[loading]]></category>
		<category><![CDATA[Map Embed]]></category>
		<category><![CDATA[microphone]]></category>
		<category><![CDATA[object 태그]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[PDF뷰어]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Permissions Policy]]></category>
		<category><![CDATA[picture-in-picture]]></category>
		<category><![CDATA[postMessage]]></category>
		<category><![CDATA[React]]></category>
		<category><![CDATA[referrerpolicy]]></category>
		<category><![CDATA[Responsive iframe]]></category>
		<category><![CDATA[Responsive Web]]></category>
		<category><![CDATA[Same-Origin Policy]]></category>
		<category><![CDATA[sandbox]]></category>
		<category><![CDATA[Screen Reader]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SPA]]></category>
		<category><![CDATA[src]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[Third-Party Content]]></category>
		<category><![CDATA[title]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[UX]]></category>
		<category><![CDATA[Vue.js]]></category>
		<category><![CDATA[WAI-ARIA]]></category>
		<category><![CDATA[Web Components]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web Performance]]></category>
		<category><![CDATA[Web Security]]></category>
		<category><![CDATA[Web Standards]]></category>
		<category><![CDATA[width]]></category>
		<category><![CDATA[X-Frame-Options]]></category>
		<category><![CDATA[YouTube]]></category>
		<category><![CDATA[YouTube Embed]]></category>
		<category><![CDATA[개발자도구]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[구글맵임베드]]></category>
		<category><![CDATA[구글지도]]></category>
		<category><![CDATA[기능정책]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[동일출처정책]]></category>
		<category><![CDATA[디버깅]]></category>
		<category><![CDATA[리액트]]></category>
		<category><![CDATA[문제해결]]></category>
		<category><![CDATA[반응형iframe]]></category>
		<category><![CDATA[반응형웹]]></category>
		<category><![CDATA[보안]]></category>
		<category><![CDATA[뷰]]></category>
		<category><![CDATA[브라우저]]></category>
		<category><![CDATA[블레이저]]></category>
		<category><![CDATA[성능]]></category>
		<category><![CDATA[스크린리더]]></category>
		<category><![CDATA[싱글페이지애플리케이션]]></category>
		<category><![CDATA[외부콘텐츠]]></category>
		<category><![CDATA[웹개발]]></category>
		<category><![CDATA[웹메시징]]></category>
		<category><![CDATA[웹보안]]></category>
		<category><![CDATA[웹성능]]></category>
		<category><![CDATA[웹접근성]]></category>
		<category><![CDATA[웹컴포넌트]]></category>
		<category><![CDATA[웹퍼블리셔]]></category>
		<category><![CDATA[웹페이지]]></category>
		<category><![CDATA[웹표준]]></category>
		<category><![CDATA[유튜브]]></category>
		<category><![CDATA[유튜브임베드]]></category>
		<category><![CDATA[이벤트리스너]]></category>
		<category><![CDATA[인라인요소]]></category>
		<category><![CDATA[인라인프레임]]></category>
		<category><![CDATA[임베드]]></category>
		<category><![CDATA[자바스크립트]]></category>
		<category><![CDATA[접근성]]></category>
		<category><![CDATA[종횡비]]></category>
		<category><![CDATA[지연로딩]]></category>
		<category><![CDATA[최적화]]></category>
		<category><![CDATA[코딩]]></category>
		<category><![CDATA[클릭재킹]]></category>
		<category><![CDATA[키보드네비게이션]]></category>
		<category><![CDATA[퍼블리싱]]></category>
		<category><![CDATA[프레임]]></category>
		<category><![CDATA[프레임워크]]></category>
		<category><![CDATA[프로그래밍]]></category>
		<category><![CDATA[프론트엔드]]></category>
		<category><![CDATA[호환성]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=40225</guid>

					<description><![CDATA[<p>HTML iframe? &#60;iframe> (Inline Frame) 태그는 현재 HTML 문서 안에 다른 웹 페이지나 미디어 콘텐츠를 임베드(embed)할 때 사용하는 HTML 요소입니다. 외부 콘텐츠를 현재 페이지에 &#8220;창문처럼&#8221; 삽입하는 기능을 제공하며, 웹 개발에서 매우 유용한 도구입니다. 1. 기본 구조와 문법 기본 문법 최소 권장 구조 2. 핵심 속성 속성 설명 예시 필수여부 src 임베드할 콘텐츠의 URL src="https://www.youtube.com/embed/동영상ID" 필수 [&#8230;]</p>
<p>The post <a href="https://lycos7560.com/etc/html-iframe-%ec%a0%95%eb%a6%ac/40225/">HTML iframe 정리</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-d4c23dad      "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							목차						</div>
																						<div class="uagb-toc__list-wrap ">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#html-iframe" class="uagb-toc-link__trigger">HTML iframe?</a><li class="uagb-toc__list"><a href="#1-기본-구조와-문법" class="uagb-toc-link__trigger">1. 기본 구조와 문법</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#기본-문법" class="uagb-toc-link__trigger">기본 문법</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#최소-권장-구조" class="uagb-toc-link__trigger">최소 권장 구조</a></li></ul></li><li class="uagb-toc__list"><a href="#2-핵심-속성" class="uagb-toc-link__trigger">2. 핵심 속성</a><li class="uagb-toc__list"><a href="#3-주요-사용-사례" class="uagb-toc-link__trigger">3. 주요 사용 사례</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#1-youtube-동영상-임베드" class="uagb-toc-link__trigger">1) YouTube 동영상 임베드</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#2-google-maps-임베드" class="uagb-toc-link__trigger">2) Google Maps 임베드</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#3-pdf-문서-표시" class="uagb-toc-link__trigger">3) PDF 문서 표시</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#4-인라인-html-콘텐츠-srcdoc-사용" class="uagb-toc-link__trigger">4) 인라인 HTML 콘텐츠 (srcdoc 사용)</a></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#4-보안-및-권한-제어-속성-sandbox-allow" class="uagb-toc-link__trigger">4. 보안 및 권한 제어 속성 (sandbox &amp; allow)</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#41-sandbox-속성-보안-제한-설정" class="uagb-toc-link__trigger">4.1 sandbox 속성 &#8211; 보안 제한 설정</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#42-allow-속성-기능-권한-제어" class="uagb-toc-link__trigger">4.2 allow 속성 &#8211; 기능 권한 제어</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#43-사용-예시" class="uagb-toc-link__trigger">4.3 사용 예시</a></li></ul></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#5-보안-및-성능-고려사항" class="uagb-toc-link__trigger">5. 보안 및 성능 고려사항</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#보안-고려사항" class="uagb-toc-link__trigger"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f512.png" alt="🔒" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 보안 고려사항</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#성능-최적화" class="uagb-toc-link__trigger"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/26a1.png" alt="⚡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 성능 최적화</a></li></ul></li></ul></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#6-반응형-디자인" class="uagb-toc-link__trigger">6. 반응형 디자인</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#css를-이용한-반응형-iframe" class="uagb-toc-link__trigger">CSS를 이용한 반응형 iframe</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#다양한-비율-지원" class="uagb-toc-link__trigger">다양한 비율 지원</a></li></ul></li></ul></li></ul></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#7-javascript와의-상호작용" class="uagb-toc-link__trigger">7. JavaScript와의 상호작용</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#postmessage-api-사용" class="uagb-toc-link__trigger">postMessage API 사용</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#iframe-로드-완료-감지" class="uagb-toc-link__trigger">iframe 로드 완료 감지</a></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#8-프레임워크별-사용-예시" class="uagb-toc-link__trigger">8. 프레임워크별 사용 예시</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#react" class="uagb-toc-link__trigger">React</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#vuejs" class="uagb-toc-link__trigger">Vue.js</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#blazor" class="uagb-toc-link__trigger">Blazor</a></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#9-접근성-accessibility" class="uagb-toc-link__trigger">9. 접근성 (Accessibility)</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#필수-접근성-고려사항" class="uagb-toc-link__trigger">필수 접근성 고려사항</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#키보드-네비게이션" class="uagb-toc-link__trigger">키보드 네비게이션</a></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#10-문제-해결-및-디버깅" class="uagb-toc-link__trigger">10. 문제 해결 및 디버깅</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#일반적인-문제들" class="uagb-toc-link__trigger">일반적인 문제들</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#디버깅-도구" class="uagb-toc-link__trigger">디버깅 도구</a></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#11-모범-사례-및-권장사항" class="uagb-toc-link__trigger">11. 모범 사례 및 권장사항</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#권장사항" class="uagb-toc-link__trigger"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 권장사항</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#피해야-할-것들" class="uagb-toc-link__trigger"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 피해야 할 것들</a></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#12-대안-기술들" class="uagb-toc-link__trigger">12. 대안 기술들</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#1-object-태그" class="uagb-toc-link__trigger">1. object 태그</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#2-embed-태그" class="uagb-toc-link__trigger">2. embed 태그</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#3-web-components" class="uagb-toc-link__trigger">3. Web Components</a></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#결론" class="uagb-toc-link__trigger">결론</a></ul></ul></ul></ul></ul></ul></ul></ul></ul></ul></ul></ol>					</div>
									</div>
				</div>
			


<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">HTML iframe?</h2>



<p><code>&lt;iframe></code> (Inline Frame) 태그는 <strong>현재 HTML 문서 안에 다른 웹 페이지나 미디어 콘텐츠를 임베드(embed)할 때 사용하는 HTML 요소</strong>입니다. </p>



<p>외부 콘텐츠를 현재 페이지에 &#8220;창문처럼&#8221; 삽입하는 기능을 제공하며, <strong>웹 개발에서 매우 유용한 도구</strong>입니다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">1. 기본 구조와 문법</h2>



<h3 class="wp-block-heading">기본 문법</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;iframe 
    src="삽입할_콘텐츠_URL" 
    width="너비" 
    height="높이" 
    title="프레임 설명"
    allow="fullscreen">
    &lt;!-- 대체 콘텐츠 (iframe을 지원하지 않는 브라우저용) -->
    &lt;p>이 브라우저는 iframe을 지원하지 않습니다.&lt;/p>
&lt;/iframe>
</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">최소 권장 구조</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;iframe 
    src="https://example.com" 
    title="Example Website"
    width="600" 
    height="400">
&lt;/iframe>
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">2. 핵심 속성</h2>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>속성</th><th>설명</th><th>예시</th><th>필수여부</th></tr></thead><tbody><tr><td><code>src</code></td><td>임베드할 콘텐츠의 URL</td><td><code>src="https://www.youtube.com/embed/동영상ID"</code></td><td><strong>필수</strong></td></tr><tr><td><code>width</code>/<code>height</code></td><td>프레임 크기 (픽셀 또는 %)</td><td><code>width="600" height="400"</code></td><td>권장</td></tr><tr><td><code>title</code></td><td>접근성을 위한 프레임 설명</td><td><code>title="YouTube 동영상"</code></td><td><strong>권장</strong></td></tr><tr><td><code><s>frameborder</s></code></td><td><s>테두리 표시 여부 </s>(HTML5에선 CSS로 대체)</td><td><code><s>frameborder="0"</s></code></td><td><s>선택</s></td></tr><tr><td><code>allowfullscreen</code><br><code>allowfullscreen</code>은 오래된 방식이며, <br>최신 표준인 <strong>권한 정책(Permissions Policy)에서는</strong><br><strong><code>allow="fullscreen"</code>을 사용</strong>하는 것을 권장</td><td>전체 화면 모드 허용</td><td>불리언 속성</td><td>선택</td></tr><tr><td><code>sandbox</code></td><td>보안 제한 설정</td><td><code>sandbox="allow-scripts allow-same-origin"</code></td><td>선택</td></tr><tr><td><code>loading</code></td><td>로딩 방식 (lazy/eager)</td><td><code>loading="lazy"</code></td><td>선택</td></tr><tr><td><code>allow</code></td><td>기능 정책 설정</td><td><code>allow="camera; microphone"</code></td><td>선택</td></tr><tr><td><code>name</code></td><td>프레임 이름 (target으로 사용)</td><td><code>name="myFrame"</code></td><td>선택</td></tr><tr><td><code>srcdoc</code></td><td>인라인 HTML 콘텐츠</td><td><code>srcdoc="&lt;p&gt;Hello World&lt;/p&gt;"</code></td><td>선택</td></tr><tr><td><code>id</code></td><td>고유 식별자 (CSS, JavaScript에서 참조)</td><td><code>id="myIframe"</code></td><td>권장</td></tr></tbody></table></figure>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">3. 주요 사용 사례</h2>



<h3 class="wp-block-heading">1) YouTube 동영상 임베드</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;div class="video-container">
    &lt;iframe src="https://www.youtube.com/embed/rdwz7QiG0lk?enablejsapi=1"
            id="ytPlayer"
            width="560"
            height="315"
            title="YouTube on the tube!"
            allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; fullscreen; picture-in-picture; web-share">
    &lt;/iframe>
&lt;/div>

&lt;style>
    .video-container {
        position: relative;
        padding-bottom: 56.25%; /* 16:9 비율 */
        height: 0;
        overflow: hidden;
    }

    .video-container iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
&lt;/style></pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">2) Google Maps 임베드</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;iframe
    src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3165.303576908283!2d127.024612!3d37.515582!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x0!2zMzfCsDMwJzU2LjEiTiAxMjfCsDAxJzI4LjYiRQ!5e0!3m2!1sen!2skr!4v1620000000000!5m2!1sen!2skr"
    width="600"
    height="450"
    title="Google Maps"
    style="border:0;"
    allow="fullscreen"
    loading="lazy"
    referrerpolicy="no-referrer-when-downgrade">
&lt;/iframe>
</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">3) PDF 문서 표시</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">
&lt;iframe 
    src="/documents/sample.pdf" 
    width="100%" 
    height="600px"
    title="PDF 문서">
    &lt;p>PDF를 표시할 수 없습니다. &lt;a href="/documents/sample.pdf">다운로드&lt;/a>하세요.&lt;/p>
&lt;/iframe>
</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">4) 인라인 HTML 콘텐츠 (srcdoc 사용)</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;iframe 
    srcdoc="&lt;html>&lt;body>&lt;h1>안녕하세요!&lt;/h1>&lt;p>이것은 인라인 HTML입니다.&lt;/p>&lt;/body>&lt;/html>"
    width="400" 
    height="200"
    title="인라인 HTML">
&lt;/iframe>
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">4. 보안 및 권한 제어 속성 (sandbox &amp; allow)</h2>



<h3 class="wp-block-heading">4.1 sandbox 속성 &#8211; 보안 제한 설정</h3>



<p><code>sandbox</code> 속성은 iframe 내 콘텐츠의 보안을 강화하기 위해 사용됩니다. </p>



<p><strong>기본적으로 모든 것을 차단</strong>하고 필요한 기능만 허용하는 방식입니다.</p>



<h4 class="wp-block-heading">sandbox 기본 사용법</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;!-- 모든 제한 적용 (최고 보안) -->
&lt;iframe src="..." sandbox>&lt;/iframe>

&lt;!-- 특정 기능만 허용 -->
&lt;iframe src="..." sandbox="allow-scripts allow-same-origin allow-forms">&lt;/iframe></pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">sandbox 값들</h4>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>sandbox 값</th><th>설명</th><th>사용 예시</th></tr></thead><tbody><tr><td><code>allow-forms</code></td><td>폼 제출 허용</td><td>로그인, 검색 폼이 있는 페이지</td></tr><tr><td><code>allow-scripts</code></td><td>JavaScript 실행 허용</td><td>인터랙티브 콘텐츠</td></tr><tr><td><code>allow-same-origin</code></td><td>동일 출처 정책 적용</td><td>API 호출, 쿠키 접근</td></tr><tr><td><code>allow-popups</code></td><td>팝업 창 열기 허용</td><td>새 창으로 링크 열기</td></tr><tr><td><code>allow-top-navigation</code></td><td>최상위 프레임 네비게이션 허용</td><td>부모 페이지 이동</td></tr><tr><td><code>allow-pointer-lock</code></td><td>포인터 잠금 API 허용</td><td>게임, 3D 앱</td></tr><tr><td><code>allow-fullscreen</code></td><td>전체 화면 모드 허용</td><td>동영상 플레이어</td></tr><tr><td><code>allow-downloads</code></td><td>파일 다운로드 허용</td><td>문서 다운로드</td></tr><tr><td><code>allow-modals</code></td><td>모달 창 허용</td><td>alert, confirm 등</td></tr></tbody></table></figure>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">4.2 allow 속성 &#8211; 기능 권한 제어</h3>



<p><code>allow</code> 속성은 브라우저의 고급 기능에 대한 접근 권한을 제어합니다. </p>



<p><strong>Permissions Policy</strong>를 통해 특정 웹 API 사용을 허용하거나 차단합니다.</p>



<h4 class="wp-block-heading">allow 기본 사용법</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;!-- 특정 브라우저 기능 허용 -->
&lt;iframe src="..." 
        allow="camera; microphone; geolocation">
&lt;/iframe>

&lt;!-- YouTube 동영상에 필요한 기능들 -->
&lt;iframe src="https://www.youtube.com/embed/..."
        allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share">
&lt;/iframe></pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">allow 값들</h4>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th><strong>값</strong></th><th><strong>설명</strong></th><th><strong>사용 예시</strong></th></tr></thead><tbody><tr><td><code>camera</code></td><td>카메라 접근 허용</td><td>화상 통화, 사진 촬영</td></tr><tr><td><code>microphone</code></td><td>마이크 접근 허용</td><td>음성 녹음, 통음</td></tr><tr><td><code>geolocation</code></td><td>위치 정보 접근 허용</td><td>지도 서비스, 위치 기반 기능</td></tr><tr><td><code>autoplay</code></td><td>자동 재생 허용</td><td>동영상/음악 자동 재생</td></tr><tr><td><code>encrypted-media</code></td><td>DRM 보호 콘텐츠 재생 허용</td><td>Netflix, 유료 스트리밍 서비스</td></tr><tr><td><code>picture-in-picture</code></td><td>PIP(작은 창) 모드 허용</td><td>동영상 시청 중 다른 작업</td></tr><tr><td><code>accelerometer</code></td><td>가속도계(기기 움직임) 접근 허용</td><td>모바일 게임, VR 콘텐츠</td></tr><tr><td><code>gyroscope</code></td><td>자이로스코프(기기 회전) 접근 허용</td><td>360도 동영상, AR 앱</td></tr><tr><td><code>clipboard-write</code></td><td>클립보드 복사 기능 허용</td><td>텍스트/이미지 복사 버튼</td></tr><tr><td><code>web-share</code></td><td>운영체제 공유 기능 허용</td><td>SNS 공유, 링크 공유</td></tr><tr><td><code>fullscreen</code></td><td>전체 화면 모드 허용</td><td>동영상 전체 화면으로 보기</td></tr></tbody></table></figure>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">4.3 사용 예시</h3>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">신뢰할 수 없는 콘텐츠 (높은 보안)</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;!-- 외부 광고, 사용자 생성 콘텐츠 -->
&lt;iframe src="https://untrusted-ads.com/banner" 
        sandbox="allow-scripts"
        width="300" height="250">
&lt;/iframe></pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">부분적으로 신뢰하는 콘텐츠 (중간 보안)</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;!-- 서드파티 앱, 외부 도구 -->
&lt;iframe src="https://third-party-tool.com"
        sandbox="allow-scripts allow-same-origin allow-forms"
        allow="clipboard-write"
        width="600" height="400">
&lt;/iframe></pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">신뢰할 수 있는 서비스 (기능 중심)</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;!-- YouTube, Google Maps 등 -->
&lt;iframe src="https://www.youtube.com/embed/rdwz7QiG0lk"
        allow="accelerometer; autoplay; encrypted-media; fullscreen; gyroscope; picture-in-picture; web-share">
&lt;/iframe></pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">둘 다 사용하는 경우</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;!-- 보안과 기능 모두 제어 -->
&lt;iframe src="https://video-chat-app.com"
        sandbox="allow-scripts allow-same-origin allow-forms"
        allow="camera; microphone; autoplay"
        width="800" height="600">
&lt;/iframe></pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">5. 보안 및 성능 고려사항</h2>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f512.png" alt="🔒" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 보안 고려사항</h3>



<h4 class="wp-block-heading">X-Frame-Options 헤더</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">X-Frame-Options: DENY          # 모든 프레임에서 차단
X-Frame-Options: SAMEORIGIN   # 동일 출처에서만 허용
X-Frame-Options: ALLOW-FROM https://example.com  # 대부분 지원 중단되었으므로 CSP frame-ancestors를 사용

# "특정 도메인"은 해당 웹사이트를 iframe으로 임베드할 수 있는 허용된 출처(도메인)를 의미</pre>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="965" height="490" src="https://lycos7560.com/wp-content/uploads/2025/08/image-13.png" alt="" class="wp-image-40229" srcset="https://lycos7560.com/wp-content/uploads/2025/08/image-13.png 965w, https://lycos7560.com/wp-content/uploads/2025/08/image-13-300x152.png 300w, https://lycos7560.com/wp-content/uploads/2025/08/image-13-768x390.png 768w" sizes="(max-width: 965px) 100vw, 965px" /><figcaption class="wp-element-caption"><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Frame-Options#browser_compatibility" target="_blank" rel="noreferrer noopener">https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Frame-Options#browser_compatibility</a></figcaption></figure>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">Content Security Policy (CSP)</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;meta http-equiv="Content-Security-Policy" 
      content="frame-src https://youtube.com https://maps.google.com;">
</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">안전한 iframe 사용법</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;iframe 
    src="https://trusted-site.com"
    sandbox="allow-scripts allow-same-origin"
    referrerpolicy="strict-origin-when-cross-origin">
&lt;/iframe>
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/26a1.png" alt="⚡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 성능 최적화</h3>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">지연 로딩 (Lazy Loading)</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;iframe 
    src="https://example.com" 
    loading="lazy"
    width="600" 
    height="400">
&lt;/iframe>
</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">리소스 힌트 사용</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;!-- DNS 사전 해석 -->
&lt;link rel="dns-prefetch" href="https://www.youtube.com">

&lt;!-- 사전 연결 -->
&lt;link rel="preconnect" href="https://www.youtube.com">

&lt;!-- 리소스 사전 로드 -->
&lt;link rel="preload" href="https://example.com/critical-frame" as="document">
</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">Intersection Observer를 이용한 동적 로딩</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">const observer = new IntersectionObserver((entries) => {
    entries.forEach(entry => {
        if (entry.isIntersecting) {
            const iframe = entry.target;
            iframe.src = iframe.dataset.src;
            observer.unobserve(iframe);
        }
    });
});

document.querySelectorAll('iframe[data-src]').forEach(iframe => {
    observer.observe(iframe);
});
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">6. 반응형 디자인</h2>



<h3 class="wp-block-heading">CSS를 이용한 반응형 iframe</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">.iframe-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 비율 */
    height: 0;
    overflow: hidden;
}

.iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
</pre>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;div class="iframe-container">
    &lt;iframe src="https://www.youtube.com/embed/dQw4w9WgXcQ" 
            title="YouTube 동영상"
            allow="fullscreen">
    &lt;/iframe>
&lt;/div>
</pre>



<h3 class="wp-block-heading">다양한 비율 지원</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">.aspect-16-9 { padding-bottom: 56.25%; }  /* 16:9 */
.aspect-4-3 { padding-bottom: 75%; }      /* 4:3 */
.aspect-1-1 { padding-bottom: 100%; }     /* 1:1 */
.aspect-21-9 { padding-bottom: 42.86%; }  /* 21:9 */
</pre>



<h2 class="wp-block-heading">7. JavaScript와의 상호작용</h2>



<h3 class="wp-block-heading">postMessage API 사용</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">// 부모 페이지에서 iframe으로 메시지 전송
const iframe = document.getElementById('myFrame');
iframe.contentWindow.postMessage('Hello from parent', '*');

// 메시지 수신 리스너
window.addEventListener('message', (event) => {
    if (event.origin !== 'https://trusted-domain.com') return;
    console.log('받은 메시지:', event.data);
});
</pre>



<h3 class="wp-block-heading">iframe 로드 완료 감지</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">const iframe = document.getElementById('myFrame');
iframe.addEventListener('load', () => {
    console.log('iframe 로드 완료');
});
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">8. 프레임워크별 사용 예시</h2>



<h3 class="wp-block-heading">React</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">function YouTubeEmbed({ videoId }) {
    return (
        &lt;div className="iframe-container">
            &lt;iframe
                src={`https://www.youtube.com/embed/${videoId}`}
                title="YouTube video player"
                allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen"
            />
        &lt;/div>
    );
}</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Vue.js</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;template>
    &lt;div class="iframe-container">
        &lt;iframe
            :src="`https://www.youtube.com/embed/${videoId}`"
            title="YouTube video player"
            allow="fullscreen"
        />
    &lt;/div>
&lt;/template>

&lt;script>
export default {
    props: ['videoId']
}
&lt;/script>
</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Blazor</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">@page "/iframe-demo"

&lt;div class="iframe-wrapper">
    &lt;iframe src="https://www.youtube.com/embed/dQw4w9WgXcQ"
            width="560"
            height="315"
            title="YouTube 동영상"
            allow="fullscreen"
            class="youtube-frame">
    &lt;/iframe>
&lt;/div>

&lt;style>
    .youtube-frame {
        border: none;
        border-radius: 8px;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }
    
    .iframe-wrapper {
        display: flex;
        justify-content: center;
        margin: 20px 0;
    }
&lt;/style>
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">9. 접근성 (Accessibility)</h2>



<h3 class="wp-block-heading">필수 접근성 고려사항</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;iframe
    src="https://example.com"
    title="명확하고 설명적인 제목"
    aria-label="iframe 내용에 대한 추가 설명"
    tabindex="0">
    &lt;p>이 콘텐츠를 보려면 &lt;a href="https://example.com">여기를 클릭&lt;/a>하세요.&lt;/p>
&lt;/iframe>
</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">키보드 네비게이션</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="css" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">iframe:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">10. 문제 해결 및 디버깅</h2>



<h3 class="wp-block-heading">일반적인 문제들</h3>



<h4 class="wp-block-heading">1. 콘텐츠가 보이지 않을 때</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">// 개발자 도구에서 확인할 사항들
console.log('iframe src:', iframe.src);
console.log('iframe 로드 상태:', iframe.readyState);

// 오류 핸들링
iframe.addEventListener('error', (e) => {
    console.error('iframe 로드 오류:', e);
});
</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">2. X-Frame-Options 오류 해결</h4>



<ul class="wp-block-list">
<li>개발자 도구 → Network 탭에서 응답 헤더 확인</li>



<li>가능한 해결책: 프록시 서버 사용 또는 API를 통한 콘텐츠 가져오기</li>
</ul>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading">3. CORS 정책 위반</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">// 안전한 방법: 서버 사이드에서 콘텐츠 프록시
fetch('/api/proxy?url=' + encodeURIComponent(targetUrl))
    .then(response => response.text())
    .then(html => {
        iframe.srcdoc = html;
    });
</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">디버깅 도구</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">// iframe 상태 체크 함수
function checkIframeStatus(iframeId) {
    const iframe = document.getElementById(iframeId);
    console.log({
        src: iframe.src,
        contentDocument: iframe.contentDocument,
        contentWindow: iframe.contentWindow,
        readyState: iframe.readyState
    });
}
</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">11. 모범 사례 및 권장사항</h2>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 권장사항</h3>



<ol class="wp-block-list">
<li><strong>항상 <code>title</code> 속성 제공</strong> &#8211; 접근성을 위해 필수</li>



<li><strong>적절한 크기 설정</strong> &#8211; 반응형 디자인 고려</li>



<li><strong>loading=&#8221;lazy&#8221; 사용</strong> &#8211; 성능 최적화</li>



<li><strong>sandbox 속성 활용</strong> &#8211; 보안 강화</li>



<li><strong>대체 콘텐츠 제공</strong> &#8211; 호환성 보장</li>



<li><strong>HTTPS 사용</strong> &#8211; 보안 및 호환성</li>
</ol>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 피해야 할 것들</h3>



<ol class="wp-block-list">
<li><strong>frameborder 속성</strong> &#8211; HTML5에서는 CSS 사용 권장</li>



<li><strong>과도한 중첩</strong> &#8211; 성능 저하 원인</li>



<li><strong>신뢰할 수 없는 소스</strong> &#8211; 보안 위험</li>



<li><strong>고정 크기만 사용</strong> &#8211; 반응형 웹에 부적합</li>



<li><strong>title 속성 누락</strong> &#8211; 접근성 문제</li>
</ol>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">12. 대안 기술들</h2>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">1. object 태그</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;object data="document.pdf" type="application/pdf" width="600" height="400">
    &lt;p>PDF를 표시할 수 없습니다. &lt;a href="document.pdf">다운로드&lt;/a>하세요.&lt;/p>
&lt;/object>
</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">2. embed 태그</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;embed src="movie.mp4" type="video/mp4" width="600" height="400">
</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">3. Web Components</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">class CustomEmbed extends HTMLElement {
    connectedCallback() {
        this.innerHTML = `
            &lt;iframe src="${this.getAttribute('src')}" 
                    title="${this.getAttribute('title')}">
            &lt;/iframe>
        `;
    }
}
customElements.define('custom-embed', CustomEmbed);
</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">결론</h2>



<p>iframe은 웹 개발에서 외부 콘텐츠를 삽입하는 강력한 도구입니다. </p>



<p>올바른 사용법과 보안 고려사항을 숙지하여 안전하고 효율적인 웹 애플리케이션을 개발할 수 있습니다. </p>



<p>특히 현대 웹 개발에서는 성능, 보안, 접근성을 모두 고려한 구현이 중요합니다.</p>



<p></p>
<p>The post <a href="https://lycos7560.com/etc/html-iframe-%ec%a0%95%eb%a6%ac/40225/">HTML iframe 정리</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/etc/html-iframe-%ec%a0%95%eb%a6%ac/40225/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>MAUI Blazor Hybrid Radzen 적용</title>
		<link>https://lycos7560.com/c/blazor/maui-blazor-hybrid-radzen-%ec%a0%81%ec%9a%a9/39214/</link>
					<comments>https://lycos7560.com/c/blazor/maui-blazor-hybrid-radzen-%ec%a0%81%ec%9a%a9/39214/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Wed, 22 Jan 2025 17:37:50 +0000</pubDate>
				<category><![CDATA[Blazor]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=39214</guid>

					<description><![CDATA[<p>https://www.radzen.com/blazor-studio/documentation/maui index.html MainLayout.razor _Imports.razor MauiProgram.cs Home.razor</p>
<p>The post <a href="https://lycos7560.com/c/blazor/maui-blazor-hybrid-radzen-%ec%a0%81%ec%9a%a9/39214/">MAUI Blazor Hybrid Radzen 적용</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p><a href="https://www.radzen.com/blazor-studio/documentation/maui" target="_blank" rel="noreferrer noopener">https://www.radzen.com/blazor-studio/documentation/maui</a></p>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">2025/01/23
net9.0
Radzen v5.7.10</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p>index.html</p>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;!DOCTYPE html>
&lt;html lang="en">
&lt;head>
    &lt;meta charset="utf-8" />
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
    &lt;title>MauiBlazor&lt;/title>
    &lt;base href="/" />

    &lt;link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
    &lt;!-- Radzen Head Start [Before css/app.css] -->
    &lt;link rel="stylesheet" href="_content/Radzen.Blazor/css/material-base.css" />
    &lt;!-- Radzen Head End -->
    &lt;link rel="stylesheet" href="css/app.css" />

    &lt;link rel="stylesheet" href="MauiBlazor.styles.css" />
    &lt;link rel="icon" href="data:,">



&lt;/head>

&lt;body>

    &lt;div class="status-bar-safe-area">&lt;/div>

    &lt;div id="app">Loading...&lt;/div>

    &lt;div id="blazor-error-ui">
        An unhandled error has occurred.
        &lt;a href="" class="reload">Reload&lt;/a>
        &lt;a class="dismiss">🗙&lt;/a>
    &lt;/div>

    &lt;script src="_framework/blazor.webview.js" autostart="false">&lt;/script>
    &lt;!-- Radzen JS Start [After webview.js] -->
    &lt;script src="_content/Radzen.Blazor/Radzen.Blazor.js">&lt;/script>
    &lt;!-- Radzen JS End -->

&lt;/body>

&lt;/html></pre>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p>MainLayout.razor</p>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">@inherits LayoutComponentBase

&lt;!-- Radzen Start [ before div class="page"] -->
&lt;RadzenComponents />
&lt;!-- Radzen End -->

&lt;div class="page">

    &lt;div class="sidebar">
        &lt;NavMenu />
    &lt;/div>

    &lt;main>
        &lt;div class="top-row px-4">
            &lt;a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About&lt;/a>
        &lt;/div>

        &lt;article class="content px-4">
            @Body
        &lt;/article>
    &lt;/main>

&lt;/div>
</pre>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p>_Imports.razor</p>



<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">@using System.Net.Http
@using System.Net.Http.Json
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using MauiBlazor
@using MauiBlazor.Components

@* Radzen Import Start *@
@using Radzen
@using Radzen.Blazor
@* Radzen Import End *@
</pre>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p>MauiProgram.cs</p>



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">using Microsoft.Extensions.Logging;
using Radzen;

namespace MauiBlazor
{
    public static class MauiProgram
    {
        public static MauiApp CreateMauiApp()
        {
            var builder = MauiApp.CreateBuilder();
            builder
                .UseMauiApp&lt;App>()
                .ConfigureFonts(fonts =>
                {
                    fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
                });
            builder.Services.AddMauiBlazorWebView();

            // Radzen Builder Start After [AddMauiBlazorWebView]
            builder.Services.AddRadzenComponents();
            // Radzen Builder End

#if DEBUG
            builder.Services.AddBlazorWebViewDeveloperTools();
    		builder.Logging.AddDebug();
#endif

            return builder.Build();
        }
    }
}
</pre>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Home.razor</p>



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">@inject NotificationService NotificationService
@page "/"

&lt;h1>Hello, world!&lt;/h1>

Welcome to your new app.

&lt;RadzenButton Click=@(args => ButtonClicked()) Text=@ButtonName ButtonStyle="ButtonStyle.Primary" />

@code {

    private int currentCount = 0;
    public string ButtonName => $"Click {currentCount.ToString()}";

    void ButtonClicked()
    {
        currentCount++;
    }
}</pre>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="725" height="313" src="https://lycos7560.com/wp-content/uploads/2025/01/image-3.png" alt="" class="wp-image-39215" srcset="https://lycos7560.com/wp-content/uploads/2025/01/image-3.png 725w, https://lycos7560.com/wp-content/uploads/2025/01/image-3-300x130.png 300w" sizes="(max-width: 725px) 100vw, 725px" /></figure>



<p></p>



<p></p>
<p>The post <a href="https://lycos7560.com/c/blazor/maui-blazor-hybrid-radzen-%ec%a0%81%ec%9a%a9/39214/">MAUI Blazor Hybrid Radzen 적용</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/c/blazor/maui-blazor-hybrid-radzen-%ec%a0%81%ec%9a%a9/39214/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Dependency Inversion Principle(DIP, 의존성 역전 원리)</title>
		<link>https://lycos7560.com/c/dependency-inversion-principledip-%ec%9d%98%ec%a1%b4%ec%84%b1-%ec%97%ad%ec%a0%84-%ec%9b%90%eb%a6%ac/38731/</link>
					<comments>https://lycos7560.com/c/dependency-inversion-principledip-%ec%9d%98%ec%a1%b4%ec%84%b1-%ec%97%ad%ec%a0%84-%ec%9b%90%eb%a6%ac/38731/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Sun, 03 Nov 2024 07:48:04 +0000</pubDate>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Blazor]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[.Net Core]]></category>
		<category><![CDATA[AddModelError]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[ASP.NET Core]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[Consuming]]></category>
		<category><![CDATA[Controller]]></category>
		<category><![CDATA[Create]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[Data access logic]]></category>
		<category><![CDATA[DataBase]]></category>
		<category><![CDATA[DbContext]]></category>
		<category><![CDATA[DbSet]]></category>
		<category><![CDATA[DELETE]]></category>
		<category><![CDATA[Dependency]]></category>
		<category><![CDATA[Dependency Inversion]]></category>
		<category><![CDATA[Deploying]]></category>
		<category><![CDATA[DI]]></category>
		<category><![CDATA[DIP]]></category>
		<category><![CDATA[Domain]]></category>
		<category><![CDATA[Domain Model]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[FileDescription]]></category>
		<category><![CDATA[Filestream]]></category>
		<category><![CDATA[GET]]></category>
		<category><![CDATA[IFormFile]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[Image Controller]]></category>
		<category><![CDATA[IsValid]]></category>
		<category><![CDATA[Migration]]></category>
		<category><![CDATA[Model]]></category>
		<category><![CDATA[ModelState]]></category>
		<category><![CDATA[pepe]]></category>
		<category><![CDATA[POST]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[Program.cs]]></category>
		<category><![CDATA[PUT]]></category>
		<category><![CDATA[Repository]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[REST Web API]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[Upload]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[web API]]></category>
		<category><![CDATA[wpf]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[배포]]></category>
		<category><![CDATA[의존성]]></category>
		<category><![CDATA[의존성 역전]]></category>
		<category><![CDATA[의존성 역전 원리]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=38731</guid>

					<description><![CDATA[<p>Dependency Inversion Principle(DIP, 의존성 역전 원리) https://learn.microsoft.com/en-us/dotnet/architecture/modern-web-apps-azure/architectural-principles#dependency-inversion The direction of dependency within the application should be in the direction of abstraction, not implementation details.애플리케이션 내의 종속성 방향은 구현 세부 사항이 아닌 추상화 방향이어야 합니다. Most applications are written such that compile-time dependency flows in the direction of runtime execution, producing a direct dependency graph.대부분의 애플리케이션은 [&#8230;]</p>
<p>The post <a href="https://lycos7560.com/c/dependency-inversion-principledip-%ec%9d%98%ec%a1%b4%ec%84%b1-%ec%97%ad%ec%a0%84-%ec%9b%90%eb%a6%ac/38731/">Dependency Inversion Principle(DIP, 의존성 역전 원리)</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading" id="dependency-inversion">Dependency Inversion Principle(DIP, 의존성 역전 원리)</h2>



<p><a href="https://learn.microsoft.com/en-us/dotnet/architecture/modern-web-apps-azure/architectural-principles#dependency-inversion" target="_blank" rel="noreferrer noopener">https://learn.microsoft.com/en-us/dotnet/architecture/modern-web-apps-azure/architectural-principles#dependency-inversion</a></p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p>The direction of dependency within the application should be in the direction of abstraction, not implementation details.<br>애플리케이션 내의 종속성 방향은 구현 세부 사항이 아닌 추상화 방향이어야 합니다. <br>Most applications are written such that compile-time dependency flows in the direction of runtime execution, producing a direct dependency graph.<br>대부분의 애플리케이션은 컴파일 타임 종속성이 런타임 실행 방향으로 흐르도록 작성되어 직접적인 종속성 그래프를 생성합니다.</p>



<p>That is, if class A calls a method of class B and class B calls a method of class C, then at compile time class A will depend on class B, and class B will depend on class C.<br>즉, class A가 class B의 메서드를 호출하고 class B가 class C의 메서드를 호출하는 경우 컴파일 타임에 class A는 class B에 종속되고 class B는 class C에 종속됩니다.</p>



<p>코드 구조에서 세부 구현 내용에 의존하지 말고, 더 추상적이고 일반적인 개념에 의존해야 한다는 뜻<br>이렇게 하면 코드가 더 유연해지고, 변경하기 쉽고, 재사용하기도 쉬워진다.<br>예를 들어, 어떤 기능을 <strong>직접 호출하는 것보다 그 기능을 일반적으로 설명하는 인터페이스를 사용하는 것이 더 좋다는 의미</strong>)</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="669" height="556" src="https://lycos7560.com/wp-content/uploads/2024/11/image-73.png" alt="" class="wp-image-38735" srcset="https://lycos7560.com/wp-content/uploads/2024/11/image-73.png 669w, https://lycos7560.com/wp-content/uploads/2024/11/image-73-300x249.png 300w" sizes="(max-width: 669px) 100vw, 669px" /><figcaption class="wp-element-caption">Direct dependency graph.</figcaption></figure>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Applying the dependency inversion principle allows A to call methods on an abstraction that B implements, making it possible for A to call B at run time, but for B to depend on an interface controlled by A at compile time (thus,&nbsp;<em>inverting</em>&nbsp;the typical compile-time dependency).<br>종속성 반전 원칙을 적용하면 A가 B가 구현하는 추상화에 대한 메서드를 호출할 수 있으므로 A가 런타임에 B를 호출할 수 있지만 B는 컴파일 타임에 A에 의해 제어되는 인터페이스에 의존할 수 있습니다<br>(따라서 일반적인 컴파일 타임 종속성을&nbsp;<em>반전시킵니다</em>).&nbsp;</p>



<p>At run time, the flow of program execution remains unchanged, but the introduction of interfaces means that different implementations of these interfaces can easily be plugged in.<br>런타임에 프로그램 실행의 흐름은 변경되지 않지만 인터페이스의 도입은 이러한 인터페이스의 다른 구현을 쉽게 연결할 수 있음을 의미합니다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="838" height="455" src="https://lycos7560.com/wp-content/uploads/2024/11/image-74.png" alt="" class="wp-image-38736" srcset="https://lycos7560.com/wp-content/uploads/2024/11/image-74.png 838w, https://lycos7560.com/wp-content/uploads/2024/11/image-74-300x163.png 300w, https://lycos7560.com/wp-content/uploads/2024/11/image-74-768x417.png 768w" sizes="(max-width: 838px) 100vw, 838px" /><figcaption class="wp-element-caption">Inverted dependency graph.</figcaption></figure>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p><strong>Dependency inversion</strong>&nbsp;is a key part of building loosely coupled applications, since implementation details can be written to depend on and implement higher-level abstractions, rather than the other way around.<br><strong>종속성 반전</strong>은 느슨하게 결합된 애플리케이션을 구축하는 데 있어 중요한 부분인데, 그 이유는 구현 세부 정보를 작성하여 더 높은 수준의 추상화에 의존하고 구현하도록 할 수 있기 때문입니다.</p>



<p>The resulting applications are more testable, modular, and maintainable as a result.<br>그 결과 응용 프로그램은 더 쉽게 테스트할 수 있고, 모듈화되며, 유지 관리가 더 용이합니다.&nbsp;</p>



<p>The practice of&nbsp;<em>dependency injection</em>&nbsp;is made possible by following the dependency inversion principle.<br><em>종속성 주입</em>의 연습은 종속성 반전 원칙을 따름으로써 가능합니다.</p>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20)"/>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p>애플리케이션의 의존성을 구체적인 구현이 아니라 추상화된 개념에 맞추는 것</p>



<p>대부분의 애플리케이션은 A 클래스가 B 클래스를, B 클래스가 C 클래스를 호출하는 형태로 작성됩니다. </p>



<p>이는 A가 B에, B가 C에 의존하게 만든다는 뜻입니다. 종속성 반전 원칙을 적용하면 A는 B의 구체적인 구현이 아니라 B가 구현하는 추상 개념에 의존하게 됩니다. </p>



<p>이렇게 하면 코드를 더 쉽게 테스트할 수 있고, 변경 및 유지보수가 용이해집니다. </p>



<p>간단히 말해, 코드를 유연하고 재사용 가능하게 만들어줍니다.</p>



<div style="height:102px" aria-hidden="true" class="wp-block-spacer"></div>



<p><strong>종속성 반전 적용 전</strong></p>



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">// 엔진 클래스
public class Engine
{
    public void Start()
    {
        Console.WriteLine("Engine starts.");
    }
}

// 자동차 클래스
public class Car
{
    private Engine _engine = new Engine();

    public void Start()
    {
        _engine.Start();
        Console.WriteLine("Car starts.");
    }
}

// 메인 프로그램
public class Program
{
    public static void Main(string[] args)
    {
        Car car = new Car();
        car.Start();
    }
}
</pre>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p><strong>종속성 반전 적용 후</strong></p>



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">// 인터페이스 정의
public interface IEngine
{
    void Start();
}

// 엔진 클래스
public class Engine : IEngine
{
    public void Start()
    {
        Console.WriteLine("Engine starts.");
    }
}

// 전기 엔진 클래스
public class ElectricEngine : IEngine
{
    public void Start()
    {
        Console.WriteLine("Electric engine starts.");
    }
}

// 자동차 클래스
public class Car
{
    private IEngine _engine;

    public Car(IEngine engine)
    {
        _engine = engine;
    }

    public void Start()
    {
        _engine.Start();
        Console.WriteLine("Car starts.");
    }
}

// 메인 프로그램
public class Program
{
    public static void Main(string[] args)
    {
        IEngine engine = new Engine();
        Car car = new Car(engine);
        car.Start();
        
        IEngine electricEngine = new ElectricEngine();
        Car electricCar = new Car(electricEngine);
        electricCar.Start();
    }
}
</pre>



<p></p>
<p>The post <a href="https://lycos7560.com/c/dependency-inversion-principledip-%ec%9d%98%ec%a1%b4%ec%84%b1-%ec%97%ad%ec%a0%84-%ec%9b%90%eb%a6%ac/38731/">Dependency Inversion Principle(DIP, 의존성 역전 원리)</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/c/dependency-inversion-principledip-%ec%9d%98%ec%a1%b4%ec%84%b1-%ec%97%ad%ec%a0%84-%ec%9b%90%eb%a6%ac/38731/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
