MSIE bug? - window.open() after alert()

M.W.Park의 이미지

이미 알려진 것일 수도 있겠지만, 저는 검색을 통해서 찾을 수는 없었습니다.
alert하나때문에 몇시간 고생한걸 생각하면 치가 떨리는군요.
삽질방지 공유차원에서 올립니다.

문제의 MSIE 버전정보:

버전: 6.0.2900.2180.xpsp_sp2_gdr.050301-1519
암호화 수준: 128-비트
제품 ID:55663-641-9636704-23798
업데이트 버전:; SP2;

테스트 html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Testing for MSIE, really sucks</title>
 
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="MSIE,bug,sucks">
    <meta http-equiv="description" content="DO NOT USE MSIE, PLZ">
 
    <script language="javascript">
<!--
/*
 * 윈도우 이름에 공백문자가 들어있다.
 * 파폭과 오페라에선 제대로 동작한다.
 * MSIE는 "오류:잘못된 인수입니다."를 출력하며 창이 열리지 않는다.
 * <a href="http://developer.mozilla.org/en/docs/DOM:window.open" rel="nofollow">http://developer.mozilla.org/en/docs/DOM:window.open</a> 을 보면 말은
 * 된다.
 * 이해해 줄 수 있는 수준이다.
 */
function test1(url) {
  var popup=window.open(url, 'foo bar');
  popup.focus();
  return false;
}
/*
 * 디버그를 위해 url을 메시지로 출력해본다.
 * 역시 파폭과 오페라에선 제대로 동작한다.
 * MSIE는 "오류:지정되지 않은 오류입니다."를 출력한다.
 * 물론 새 창도 열리지 않는다.
 */
function test2(url) {
  alert(url);
  var popup=window.open(url, 'foobar');
  popup.focus();
  return false;
}
/*
 * 잘 동작하는 코드 test2에서 alert부분만 뺐다.
 */
function test3(url) {
  var popup=window.open(url, 'foobar');
  popup.focus();
  return false;
}
// -->
    </script>
  </head>
 
  <body>
    <a href="/js_required.jsp" onclick="return test1('http://www.google.co.kr')">test1</a>
    <a href="/js_required.jsp" onclick="return test2('http://www.google.co.kr')">test2</a>
    <a href="/js_required.jsp" onclick="return test3('http://www.google.co.kr')">test3</a>
    <center>
  	처음에 공백이 들어간 윈도우 이름을 사용했다가... 제대로
  	동작하지 않아서 alert로 디버그하다가 몇시간 삽질을 하게
  	되었다. Orz. MSIE 정말 싫다.
    </center>
  </body>
</html>
Forums: 
이한길의 이미지

알려주셔서 고맙습니다..
----
먼저 알게 된 것을 알려주는 것은 즐거운 일이다!
http://hangulee.xo.st

----
먼저 알게 된 것을 알려주는 것은 즐거운 일이다!
http://hangulee.springnote.com
http://hangulee.egloos.com

flux의 이미지

윈도우 2000에서 IE 6.0.2800.1106 버전을 사용중입니다.

심심해서, 테스트해봤습니다.

첫번째 URL은 빈페이지가 나오네요. js_required.jsp 이 파일을 읽으려고 하는데, 파일이 없으니 빈페이지가 떳습니다.

두번째, URL은 http://www.google.co.kr 이라는 경고창이 뜨더니, 클릭하니까 새창으로 구글이 떳습니다.

세번째 URL은 바로 새창 뜨면서 구글이 떳습니다.

전 잘 나오는데, 무엇이 다른 결과를 낳게 했을까요?
뭐.. 전 최신 윈도우즈 업데이트가 완료된 상태이고요..

M.W.Park의 이미지

저도 신기하기도 하고 당혹스러워서 올린 글입니다.
먼저, js_required.jsp는 javascript가 지원되지 않을 경우에만 페이지를 표시해서 javascript를 enable해야한다는 메시지를 뿌리게 만든 것입니다.

test1의 경우, onclick쪽을 잘 보시면 아시겠지만... 스크립트 에러가 나지 않으면, 새창이 떠야하는데, strWindowName에 공백이 포함되어있으면, MSIE는 에러로 처리(잘못된 인수)해서 새창이 안뜨는 것같습니다. FF, Opera는 똑똑하게도 그냥 잘 처리해주고요. 이건 머 spec문서에도 그렇게 되어있으므로 큰 문제는 아니죠.
test2는 완전 미스테리고요.
test3는 잘 동작하는 놈입니다. strWindowName에 공백이 없고, 선행하는 alert()도 없는 경우죠.

저의 실행환경은 Win XP Pro고요. MSIE 버전은 상기버전이며 야후툴바, DevToolBar 가 깔려있습니다.

오늘 나의 취미는 끝없는, 끝없는 인내다. 1973 法頂

-----
오늘 의 취미는 끝없는, 끝없는 인내다. 1973 法頂

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.