Created
May 16, 2012 17:11
-
-
Save nobuoka/2712290 to your computer and use it in GitHub Desktop.
Chrome 拡張の popup 内で confirm を使うとおかしくなることがある
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Extension for test", | |
"version": "1.0", | |
"manifest_version": 2, | |
"description": "for test of alert, confirm and prompt functions", | |
"browser_action": { | |
"default_popup": "popup.html" | |
}, | |
"permissions": [ | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>test</title> | |
<script src="popup.js"></script> | |
</head> | |
<body> | |
<form id="test-form"> | |
<div> | |
<input type="submit" id="test-input"> | |
</div> | |
</form> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener( "DOMContentLoaded", function listener( evt ) { | |
var e = document.getElementById( "test-form" ); | |
e.addEventListener( "submit", function listener( evt ) { | |
// confirm( "ok?" ); | |
}, false ); | |
e = document.getElementById( "test-input" ); | |
e.addEventListener( "click", function listener( evt ) { | |
confirm( "ok?" ); | |
}, false ); | |
}, false ); | |
setTimeout( function callback() { | |
confirm( "okok?" ); | |
}, 2000 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment