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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<cfajaximport tags="cfwindow,cfform" />

<html xmlns="http://www.w3.org/1999/xhtml" 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>

<body>

<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') ob.center()