[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Cold Fusion and opening a new sized window

Posted on 2006-03-28
Medium Priority
Last Modified: 2013-12-24
I am trying to use Cold Fusion to open up a 'new window" within my Cold Fusion application.  I have several Java scripts I have used for HTML sites to open up new windows, but the scripts do not seem to work for calling up a new window to a certain size within my cold fusion application.  I do undertand that CF is a sever side application unlike Java with runs on the client side.

Is there a CF tag to achieve this  possibly? If so, how?

Currently, in my head tag I am using this:


function schools(){
schoolsWindow = window.open ("http://www.mydomain.com/schools.cfm?page=1021","books","scrollbars=yes,width=591,height=528");

then in my text, I have this:

To view the schools click <a href="javascript:schools()">here:</a>

However, CF will not open up  schools.cfm?page=1021 because it is a dynamic page.

Is there a special CF tag that will allow me to open up a new "sized" window to a dyamic page within my website?


Question by:greeneye8
LVL 10

Expert Comment

ID: 16312424
think you are missing a ;

<a href="javascript:schools();">here:</a>

Author Comment

ID: 16315519
The semi does not enable the script to work.  The script works fine and I have been using it for years with html pop ups with the semi:

a href="javascript:schools()">here:</a>

The problem with Jave is that I don't think it can pass Cold Fusion variables through it.  So my question is, can Cold Fusion even do this.... open up a controlled window (size, scrolling, etc.) within a Cold Fusion application?

Here is an example of what I am trying to do:  If you visit:


This is a CF site.  If you scroll down to the very bottom, I have a link on the right hand side called 'test'.  Currently that is linking over to another dynamic page on the site.  What I am trying to figure out is how can I make my 'test' link  or another link on that site open up a "new window" that I can control the size and other attributes of the window.  


Expert Comment

ID: 16317973
First of all, forcing a popup window on a user is an unfortunate UI decision.  That being said, the least you could do is make it so JavaScript isn't required to access the contents of the link.


Second, JavaScript doesn't care what server-side language a particular link calls just as much as your server-side language of choice cares that it was requested by a browser (in a popup or not), HTTP analysis tool, a server process, etc.

Perhaps you could help the experts assisting with your question by giving a more accurate description of the problem than simply saying "CF will not open up ... because it is a dynamic page".  Are you getting a JavaScript error when clicking on the link?  Does the popup open?  If it opens, what are you seeing in the popup window?  Is it not the page you expected?  Does it result in a ColdFusion error?  Have you tried opening the link in a regular window?  Do you get the same or different results than when attempting to open it in the popup?
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.


Accepted Solution

Teggert earned 252 total points
ID: 16336964
In the html head part of your page add the following;

<script type="text/javascript">
function newWin(theURL,winName,features) {


Then for your link,
<a href="JavaScript:parent.newWin('factsheet.cfm?pi=100415','cf','width=400,height=230,scrollbars=no');">Test</a>

Of course replacing the width, height, and actual link with whatever you are aiming for. I just threw in factsheet.cfm with the pi of whatever was there when I clicked.

The javascript works with any webpage, assuming your user has javascript enabled. If they don't, there's not really a way to force a pop-up. There isn't anything specific to ColdFusion that does this function, and if there were, it would just be something to generate javascript similar to what I've posted. Hope that helps.

Expert Comment

ID: 16336983
For more information on window.open and what features you could pass,

Assisted Solution

JeffHowden earned 248 total points
ID: 16344453
"The javascript works with any webpage, assuming your user has javascript enabled. If they don't, there's not really a way to force a pop-up."

This is not a completely true statement.  Teggert, you got him started off right by suggesting the use of a function instead of calling the window.open() method inline.  However, first, the "parent.newWin()" call is going to throw the OP for a loop.  Second, you're needlessly crippling the link for non-JS users.  Try something more like this instead:

<a href="factsheet.cfm?pi=100415" target="_blank" onclick="newWin(this.href, this.target, 'width=400,height=230,scrollbars=no'); return false">Test</a>

Non-JS users will get a new window.  JS users will get a popup.

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Loops Section Overview
Suggested Courses
Course of the Month18 days, 15 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question