본문 바로가기

TechLog

IE ActiveX 변경사항 대응책 ; ActivateActiveX

관련 URL : http://therippa.blogspot.com/2006/03/activateactivex.html




ActiveX 변경사항 관련해서 또 뭐 새로운 이슈가 없나 하고 뒤적뒤적거리다가, 음 ... ActObject(http://blog.naver.com/kenial.do?Redirect=Log&logNo=140023353046)를 외국쪽에다가도 번역해서 올려볼까 ... 하던 차에 또 새로운 솔루션 발견.


야 이거 참신하지 않습니까 ... 브라우저마다 호환성 테스트는 해봐야하지 않을까 싶은데, 뭐 그런 문제는 제끼고 생각해보자면 나름대로 괜찮은 해결방법이 아닌가 싶다.


앞에 적은 URL에서 퍼온 소스를 그대로 적어넣어 본다 :



/*
activateActiveX
---------------
Purpose:  Dynamically replace any elements that will be affected by the new security feature in IE6/IE7 that requires a user to click certain types of elements to activate them before use.

Usage:  Include this file at the end of your html document using the following...
<script language="JScript" type="text/jscript" src="activateActiveX.js"></script>


Since this script is in response to a software patent lawsuit, I feel it necessary to state the following...

License:
activateActiveX is Copyright (C) 2006 Jason Baker (therippa AT gmail.com). It is available as open source code from:
http://therippa.blogspot.com

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details http://www.gnu.org/licenses/gpl.html
*/


//Determine browser, we only need this for Internet Explorer
if (navigator.appName == "Microsoft Internet Explorer") {

//Array of elements to be replaced
var arrElements = new Array(3);
arrElements[0] = "object";
arrElements[1] = "embed";
arrElements[2] = "applet";


//Loop over element types
for (n = 0; n < arrElements.length; n++) {

 //set object for brevity
 replaceObj = document.getElementsByTagName(arrElements[n]);
 
 //loop over element objects returned
 for (i = 0; i < replaceObj.length; i++ ) {
 
  //set parent object for brevity
  parentObj = replaceObj[i].parentNode;
 
  //grab the html inside of the element before removing it from the DOM
  newHTML = parentObj.innerHTML;
 
  //remove element from the DOM
  parentObj.removeChild(replaceObj[i]);
 
  //stick the element right back in, but as a new object
  parentObj.innerHTML = newHTML;
 
  }
 }
}


단순히 내용만 replace해줘도 되는거였다니 이런 낭패가 ...