본문 바로가기
JAVASCRIPT

opener 창 닫아주기 IE 브라우저 별 구분

by Hwoarang757 2013. 8. 26.



        // opener창 닫아주기

        if (/MSIE/.test(navigator.userAgent))

        {

            if (navigator.appVersion.indexOf("MSIE 7.0") >= 0 || navigator.appVersion.indexOf("MSIE 8.0") >= 0 || navigator.appVersion.indexOf("MSIE 9.0"))

            {

                //IE7, IE8 ,IE9 일때

                window.open('about:blank', '_self').close();

            }

            else

            {

                //IE 6일때

                window.opener = self;

                self.close();

            }

        }

        else

        {

            window.name = '__t__';

            var w = window.open('about:blank');

            w.document.open();

            w.document.write('<html><body><script type="text/javascript">function _(){var w=window.open("about:blank","' + window.name + '");w.close();self.close();}</' + 'script></body></html>');

            w.document.close();

            w._();

        }