Broken (cf)windows?

This post is more than 2 years old.

A reader wrote in to say that this code, which worked fine in ColdFusion 8, now refuses to center in ColdFusion 9:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

<cfajaximport tags="cfwindow,cfform" />

<html xmlns="" xml:lang="en" lang="en"> <head> <title>My Test Window</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" />

<script language="JavaScript">

loginwin = function(){

  ColdFusion.Window.create('login', 'Account Login', 'login.cfm', {
        modal: true,
        closable: true,
        draggable: true,
        resizable: true,
        center: true,
        initshow: true,
        width: 300,
        height: 150


</script> </head>


<a onclick="loginwin();">Open the window</a>

</body> </html>

I thought perhaps it was the fancy DOCTYPE but removing that didn't help. The most I could guess at was some bug in the code used by the ColdFusion implementation. On a whim, I took a look at the Window object natively:

ob = ColdFusion.Window.getWindowObject('login') console.dir(ob)

Lo and behold, there was a center function. So to correct this issue, you can just do:

ob = ColdFusion.Window.getWindowObject('login')
Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by Mark landmann posted on 10/28/2009 at 12:58 AM

Ray, you did not address the question why it was broke when there was already a center true in the calling parameters. Instread you looked under the hood and came up with a not so obvious way to make the center happen. Are we going to have to do that for the next 15 things that Adobe broke?

Comment 2 by Raymond Camden posted on 10/28/2009 at 1:00 AM

Err, well, I thought it was obvious. It's a bug. Adobe is as perfect as any other software company, Mark. ;) I'll make sure that this issue is reported and I'm sure it will be corrected. And yes - if someone finds 15 more bugs and workarounds, I hope someone does blog it, as it helps everyone.

Comment 3 by Michael De Jonghe posted on 10/28/2009 at 2:26 AM

Over the summer I submitted a bug to Adobe about the centering of cfwindows too. When you create a cfwindow using the tag, centering works just fine.

You can also play around with the X & Y cords and view port sizes of each browser.

<cfajaximport tags="cfwindow">

var Client = {
viewportWidth: function() {
return self.innerWidth || (document.documentElement.clientWidth || document.body.clientWidth);

viewportHeight: function() {
return self.innerHeight || (document.documentElement.clientHeight || document.body.clientHeight);

viewportSize: function() {
return { width: this.viewportWidth(), height: this.viewportHeight() };

function cleanup() {

function showWin(id) {
//do we have one?
try {
} catch(e) { }

var xcord = Client.viewportWidth()/2 - 350;
var ycord = Client.viewportHeight()/2 - 200;

ColdFusion.Window.create('mywindow',id,'content.cfm?q=' + id,{x:xcord,y:ycord,center:true,height:400,width:700,modal:true,closable:true,draggable:true,resizable:true,initshow:true});

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<cfloop from="1" to="30" index="i" step="3">
<p><a href="javascript:showWin(<cfoutput>#i#</cfoutput>);">My Link</a></p>


Comment 4 by Bjorn Jensen posted on 10/28/2009 at 12:18 PM

It seems that many things regarding ajax is broken. The Ext lib has been updated and this prevents backwards compatibility and the worst is that they didn't bother updating the documentation.

Comment 5 by Raymond Camden posted on 10/28/2009 at 5:36 PM

Ok, so I know I'm an Adobe fanboy (never pretend not to be), but in their defense, CF9 was a major update in regards to the back end stuff for Ajax work. Most of the issues I've found were mainly with folks using the Ext API directly.

You say they didn't bother to update the documentation. That is wrong. You linked to a doc bug, which I agree with, but one bug does not mean the docs were not updated.

Comment 6 by Syed posted on 10/29/2009 at 10:46 PM

Ray, in my case, cfwindow is also broken under CF9. It was working perfect in our production (CF8) environment. I havent looked at ajax portion yet, but cfwindow is definitely acting weird.

Comment 7 by Raymond Camden posted on 10/29/2009 at 10:54 PM

Have you checked the release notes? If so and it's new, have you logged a bug w/ an example?

Comment 8 by Syed posted on 10/30/2009 at 7:46 PM

I havent checked the release notes nor i've filed a bug report. I'm installing win7 today on local pc's. I'll priortize this issue next.

Comment 9 by Syed posted on 11/2/2009 at 11:44 AM

Ray, just to let you know the status, I was able to fix cfwindow issue by looking over my code.

Comment 10 by Hemant posted on 11/4/2009 at 10:31 AM


Please make sure to file your bugs in the public bugtracker and we will try to resolve the same. The public bugtracker is hosted at

Comment 11 by Peter Tilbrook posted on 1/6/2012 at 8:46 AM

The CF 9.01 Update seems to have fixed the issues I was having with CF Windows. Once applied everything worked properly.