웹 페이지 특정 부분의 소스를 보는 방법입니다.
참고:
http://www.microsoft.com/windows/ie/ie6/previous/webaccess/webdevaccess.mspx1. 에디터를 이용해서 다음 내용을 *.htm 파일로 저장합니다. 여기서는
ViewSource.htm 이라고 지정했습니다.
IE6인 경우
IE6인 경우
- <script language="JavaScript" defer>
- var parentwin = external.menuArguments;
- var szsource = parentwin.document.selection.createRange().htmlText;
- if (szsource.length < 1) szsource = parentwin.document.body.outerHTML;
- szsource = szsource.replace(/(^\s*)|(\s*$)/g, "");
- szsource = szsource.replace(/</gi, "<");
- szsource = szsource.replace(/>/gi, ">");
- szsource = szsource.replace(/<(\/)?(\w+)/gi, "<$1<strong>$2</strong>");
- szsource = szsource.replace(/(href|src)\=(\'|\")?([^'\"\s]+)/gi, "<span style='color:#0000FF;font-weight:bold;'>$1</span>=$2<span style='color:#008000;font-weight:bold;'>$3</span>");
-
- var wbody = "<html>\r\n";
- wbody += "<head>\r\n";
- wbody += "<title>View Source: " + parentwin.location.href + "</title>\r\n";
- wbody += "</head>\r\n";
- wbody += "<body style='font-family:굴림,Gulim;font-size:10pt;line-height:1.5;overflow:auto;'>\r\n";
- wbody += szsource + "\r\n";
- wbody += "</body>\r\n";
- wbody += "</html>\r\n";
- var sourcewin = window.open("about:blank", "_blank", "resizable=1,scrollbars=1,width=640,height=480");
- sourcewin.document.open("text/html", "replace");
- sourcewin.document.write(wbody);
- sourcewin.document.close();
- </script>
<script language="JavaScript" defer>
var parentwin = external.menuArguments;
var szsource = parentwin.document.selection.createRange().htmlText;
if (szsource.length < 1) szsource = parentwin.document.body.outerHTML;
szsource = szsource.replace(/(^\s*)|(\s*$)/g, "");
szsource = szsource.replace(/</gi, "<");
szsource = szsource.replace(/>/gi, ">");
szsource = szsource.replace(/<(\/)?(\w+)/gi, "<$1<strong>$2</strong>");
szsource = szsource.replace(/(href|src)\=(\'|\")?([^'\"\s]+)/gi, "<span style='color:#0000FF;font-weight:bold;'>$1</span>=$2<span style='color:#008000;font-weight:bold;'>$3</span>");
// szsource = szsource.toLowerCase();
var wbody = "<html>\r\n";
wbody += "<head>\r\n";
wbody += "<title>View Source: " + parentwin.location.href + "</title>\r\n";
wbody += "</head>\r\n";
wbody += "<body style='font-family:굴림,Gulim;font-size:10pt;line-height:1.5;overflow:auto;'>\r\n";
wbody += szsource + "\r\n";
wbody += "</body>\r\n";
wbody += "</html>\r\n";
var sourcewin = window.open("about:blank", "_blank", "resizable=1,scrollbars=1,width=640,height=480");
sourcewin.document.open("text/html", "replace");
sourcewin.document.write(wbody);
sourcewin.document.close();
</script>
IE7인 경우
IE7인경우
- <script language="JavaScript" defer>
- var parentwin = external.menuArguments;
- var szsource = parentwin.document.selection.createRange().htmlText;
- if (szsource.length < 1) szsource = parentwin.document.body.outerHTML;
- szsource = szsource.replace(/(^\s*)|(\s*$)/g, "");
- szsource = szsource.replace(/</gi, "<");
- szsource = szsource.replace(/>/gi, ">");
- szsource = szsource.replace(/<(\/)?(\w+)/gi, "<$1<strong>$2</strong>");
- szsource = szsource.replace(/(href|src)\=(\'|\")?([^'\"\s]+)/gi, "<span style='color:#0000FF;font-weight:bold;'>$1</span>=$2<span style='color:#008000;font-weight:bold;'>$3</span>");
-
- var wbody = "<html>\r\n";
- wbody += "<head>\r\n";
- wbody += "<title>View Source: " + parentwin.location.href + "</title>\r\n";
- wbody += "</head>\r\n";
- wbody += "<body style='font-family:굴림,Gulim;font-size:10pt;line-height:1.5;overflow:auto;'>\r\n";
- wbody += szsource + "\r\n";
- wbody += "</body>\r\n";
- wbody += "</html>\r\n";
- var sourcewin = parentwin.open("about:blank", "_blank");
- sourcewin.document.open("text/html", "replace");
- sourcewin.document.write(wbody);
- sourcewin.document.close();
- </script>
<script language="JavaScript" defer>
var parentwin = external.menuArguments;
var szsource = parentwin.document.selection.createRange().htmlText;
if (szsource.length < 1) szsource = parentwin.document.body.outerHTML;
szsource = szsource.replace(/(^\s*)|(\s*$)/g, "");
szsource = szsource.replace(/</gi, "<");
szsource = szsource.replace(/>/gi, ">");
szsource = szsource.replace(/<(\/)?(\w+)/gi, "<$1<strong>$2</strong>");
szsource = szsource.replace(/(href|src)\=(\'|\")?([^'\"\s]+)/gi, "<span style='color:#0000FF;font-weight:bold;'>$1</span>=$2<span style='color:#008000;font-weight:bold;'>$3</span>");
// szsource = szsource.toLowerCase();
var wbody = "<html>\r\n";
wbody += "<head>\r\n";
wbody += "<title>View Source: " + parentwin.location.href + "</title>\r\n";
wbody += "</head>\r\n";
wbody += "<body style='font-family:굴림,Gulim;font-size:10pt;line-height:1.5;overflow:auto;'>\r\n";
wbody += szsource + "\r\n";
wbody += "</body>\r\n";
wbody += "</html>\r\n";
var sourcewin = parentwin.open("about:blank", "_blank");
sourcewin.document.open("text/html", "replace");
sourcewin.document.write(wbody);
sourcewin.document.close();
</script>
2. 위의 파일을 원하는 폴더에 복사합니다. 여기서는
C:\Program Files\Internet Explorer\에 저장했습니다.
3. 레지스트리 편집기를 열어
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt] 를 찾아갑니다.
4.
View Source라고 새 키를 생성한 다음, 기본값 데이터를 위 파일의 경로로 지정합니다.
5.
Contexts라는 DWORD 값을 추가하여 16진수 입력에
30라고 입력합니다.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\View Source]
@="C:\\Program Files\\Internet Explorer\\ViewSource.htm"
"Contexts"=dword:000000306. 브라우저를 종료하고 다시 실행
사용 방법:
원하는 부분을 선택해서 마우스 오른쪽을 클릭해 View Source를 선택합니다.
참고로 동영상만 선택하는 경우 오른쪽 메뉴를 쓸 수 없으므로 가급적 동영상 주변의 다른 부분도 같이 선택해주는게 좋습니다.
소스보기창입니다.
이런 식으로 해당 영역의 소스를 볼 수 있습니다.
예제 다운로드
viewsource_ie6.zipviewsource_ie7.zip크게 다른건 없지만 살짝 업데이트
viewsource_ie6_updated.zipviewsource_ie7_updated.zip