Created
November 28, 2012 22:49
-
-
Save scheib/4165303 to your computer and use it in GitHub Desktop.
chrome-app-onload-focus
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
chrome.app.runtime.onLaunched.addListener(function() { | |
chrome.app.window.create('window.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
{ | |
"name": "onload focus test", | |
"description": "Test that when a window is created it can have focus.", | |
"version": "1", | |
"manifest_version": 2, | |
"app": { | |
"background": { | |
"scripts": ["background.js"] | |
} | |
}, | |
"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
<html> | |
<body> | |
<p>When this app is opened the text area below should be focused and able to | |
receive text. Note that this works when loading this page window.html in | |
a browser.</p> | |
<textarea>Initial text.</textarea> | |
<script src="window.js"></script> | |
</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
window.onload = function () { | |
document.querySelector("textarea").value = "Type here."; | |
document.querySelector("textarea").focus(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment