I am using jQuery with a Google Chrome extension popup. The pop-up page uses jQuery’s ‘document.ready’ event to trigger a request to a web service. The problem is that the pop-up does not render until a response is received, which makes it seem unresponsive. Here’s an outline of the page:
<html>
<head>
<script type="text/javascript" src="./plugin.js"></script>
<script type="text/javascript">
$(document).ready(function() {
plugin.init();
plugin.getData();
});
</script>
</head>
<body>...</body>
</html>
Is there an event I can use to trigger ‘getData()’ after Chrome renders the pop-up? I have tried monkeying with visibility events of divs within the body, but I haven’t been able to trigger these events automatically other than by handling document.ready, which leads to the same behavior.
Use
setTimeoutwith no delay:I’ve done this in an extension of my own, and it should do the trick.