Cold Fusion and opening a new sized window

Posted on 2006-03-28
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 = ("","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

    think you are missing a ;

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

    Author Comment

    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.  

    LVL 7

    Expert Comment

    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?
    LVL 4

    Accepted Solution

    In the html head part of your page add the following;

    <script type="text/javascript">
    function newWin(theURL,winName,features) {,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.
    LVL 4

    Expert Comment

    For more information on and what features you could pass,
    LVL 7

    Assisted Solution

    "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 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,, 'width=400,height=230,scrollbars=no'); return false">Test</a>

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    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…
    If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    794 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now