i'm getting dialogue box (Operation aborted)
What is the problem in this code?
<script type="text/javascript">
$(document).ready(function() {
$('.demo').popupWindow({
centerScreen:'1'
});
});
</script>
i'm getting dialogue box (Operation aborted)
What is the problem in this code?
<script type="text/javascript">
$(document).ready(function() {
$('.demo').popupWindow({
centerScreen:'1'
});
});
</script>
Here are a couple of links describing the issue. It's specific to IE dealing with DOM manipulation.
http://support.microsoft.com/kb/927917
and
http://www.clientcide.com/code-snippets/manipulating-the-dom/ie-and-operation-aborted/
You get the "Operation aborted" message in IE when JavaScript tries to modify the DOM (the structure of the HTML page) before IE's rendering engine has finished processing it. The result is basically that the rendering engine crashes and you're taken away from the page to an "Operation Canceled" error page.
The widely posted solution is to wait until the DOM has loaded, using a tool like FastInit, prototype's $(document).observe('dom:loaded')
, or jQuery's $(document).ready
. But you are already using $(document).ready
. So your code should work.
I asked basically the same question here: http://stackoverflow.com/questions/1153534/ie7-operation-aborted-even-with-fastinit
I accepted @NickFitz's answer because not accepting an answer was causing my accept ration to go down and he provided the most useful information. Ultimately what I did was moved my script to right before the </body>
tag, and that seemed to solve the issue. Try that and see if it works for you. If you can't actually move the script, wrap it in a function and call that function. I.E:
<script type="text/javascript">
var showDemoPopupWindow = function() {
$('.demo').popupWindow({
centerScreen:'1'
});
}
</script>
...
</head>
<body>
...
...
<script type="text/javascript">
$(document).ready(showDemoPopupWindow);
</script>
</body>
</html>