🤯 50% Off! 700+ courses, assessments, and books

Dr. Design – Popups, Domain Names, Copyright and More

    Dr. Design

    The Doctor is in! This week he has a long line of patients waiting — and if you’d like to join the queue, email him your questions at drdesign@sitepoint.com

    Resizing An Already Open Popup Window

    Hey Doc,
    I need to know how to close a Popup window from a parent window.

    I have a parent page with 4 swf buttons. Each button activates a popup window _blank, and each window _blank is a different size.

    Now, here’s the problem. The first button that is selected on the parent page spawns a window – but then the size of that window is applied to all windows that are spawned from that point on.

    I want each window to popup to the specific size that I’ve assigned it, so I’d like the current window to close every time the user clicked a button. This will allow the window to resize based upon the button’s popup window specs, rather than the specs of an already-open window.

    Have I confused you? I’ve been using javascripts to amend this problem, but I can’t make it work:

    on (press) { 
       getURL (javascript:closepopup(), _blank);
    on (release) {


    Help! Afiyf

    Afiyf, although I am a doctor (in case you didn’t know already), yes I am easily confused. However, I have just the right javascript potion for the symptoms you describe.

    To close a popup window from the parent window, we just need to call it using its object handle. For example, if we opened the window like this:

    myWindow = open('http://www.name,html','thewin', 

    We can close that window from the parent:


    However there might be a simpler fix to your problem that doesn’t involve closing the open window and then opening it again. You can simply resize the window.

    Here’s an example:

    <script language="javascript"> 

     function popWindow(url, width, height) {
       popUp = open(url, 'thewin', 'toolbar=1,  
    scrollbars=1, location=1, status=1, menubar=1, resizable=1');
           popUp.resizeTo(width, height);
    <a href="javascript:popWindow('http://www.webmasterbase.com',10, 10)">
    popup small</a><br>
    <a href="javascript:popWindow('http://www.promotionbase.com',600, 600)">
    popup large</a>

    Note, though, that resizeTo may not be supported in pre-version 4 browsers. Have fun!

    Using SSI Inside a CGI Perl Script

    Hi Dr. Design,

    I’ve successfully used SSIs to bring in standard header and footer code in .shtml files. It would be nice to use the same headers and footers on CGI output. For example, I have a Perl script that processes a form and displays one of several pages in response. Ideally, I could just put an SSI include tag in the html code created by the script. Unfortunately, my hosting server doesn’t process these tags. Is there a way to make this work? Thanks!


    Emmanual, there are two approaches you could take:

    1) Instead of calling your SSI from your CGI script, which as you have already mentioned doesn’t work, you can call your CGI script from your SSI. So your shtml page might look something like:

    <!--#include virtual="/templates/top.html" --> 
    <!--#exec cgi="/cgi-bin/script.cgi"-->
    <!--#include virtual="/templates/bottom.html" -->

    2) If you want to simulate an SSI include file in your Perl script, you simply need to add a few lines to the script that will open your include file, read it and print it out (to the browser).

    Here is some Perl script that opens a file and reads its contents into an array, before printing out each line.

    open(FILE,"templates/top.html") or dienice("Can't open  
    include.html: $!");
    @ary = <FILE>;

    foreach $line (@ary) {
       print "$linen";

    Cloaked Redirection of a Domain Name

    Dear Dr.Design,
    Last week I bought my first domain name; the offer included a redirection of my Web address and redirection of e-mail. But now when I surf to my domain name, the browser always shows the name of my free host account.

    I saw on the Net that is possible to mask the host name with "cloaking"”

    "…you can mask the destination address (also called cloaking), say,
    http://www.geocities.com/mydomain/, so that only www.MyDomain.com shows up in the browser…"

    Is it a server option or can I do it with scripts? If it’s possible with scripts, do you have one, or a link where I can find one?
    Best regards, Erik.

    Erik, cloaked redirection is something that the domain registrar, or whoever is providing your DNS hosting, needs to provide for you. It is not something you will be able to achieve with scripting at your Geocities site. That’s the bad news. The good news is that you can either transfer your domain name to a registrar who does provide cloaked domain forwarding, or use a free DNS host who provides it.

    Many registrars do provide cloaked forwarding (also known as redirection). I suggest looking at any www.enom.com reseller (I personally wouldn’t purchase from enom directly, as I think they’re too expensive). However, transferring your domain to another registrar usually involves paying the registrar to extend the registration for one year (they want to make some money for their trouble). And if you’ve just registered the domain name, you can’t transfer to another registrar within the first sixty days.

    For a free DNS hosting provider, I recommend checking out zoneedit They provide a free service called "WebForward" which provides the cloaking you need. To host your DNS with someone other than your registrar, you need to get your registrar to point your domain name to the DNS server that hosts your domain name record. Usually, your registrar will have a control panel that you can log into and set the primary and secondary name servers for your domain. Good luck!

    Breaking Out of Frames Wwith a Hyperlink

    Hello Doctor,
    I’m designing a Web application. When my user logs in, I show them a page that has a navigation frame on the left, and the main frame on the right hand side.

    Now I want to place a signout link in the navigation frame, which will take back the user to main page, but currently opens in main frame only. How can I do this?

    Good news, Amit: this is easily done. In the anchor tag for your sign-out hyperlink, you simply add the property target="_top" For example:

    <a href="signout.html" target="_top">sign out</a>


    Protecting Your Web Pages

    Hi Doc,
    Every time I make a homepage, my friends or someone I don’t know will steal everything off it! I want to know if there’s some kind of alert system that will help me keep them off of my page! Can you please help?

    Dawn, with friends like those who needs enemies!? On a serious note, taking someone else’s words, artwork or design is theft of intellectual property. Unfortunately it is far too common on the Web today, and one of the many abuses of the freedom of information that the Internet has provided.

    There are a couple of thing you can do to protect your pages. The first is to restrict page access to only authorised people. You personally grant access to only those people you want to be able to use the site (hopefully people you can trust). You’ll need to give each person a user id and a password so they can access your page.

    The easiest way to restrict access is using Apache’s authorization module (mod_auth). You’ve probably been to Web pages that use mod_auth. They pop up a dialog box asking you to enter your user name and password (and have a tick box that lets you tell your browser to remember these details). This is not a simple solution to implement and would need a whole article of its own. In fact, here’s one now: it’s the Apache tutorial for mod_auth – have a read!

    Requiring authorisation is a very restrictive approach to take if you still want the wider world to be able to access your pages. Another technique that some Webmasters use is to disable the right-mouse button so visitors can’t save the images on your page to their hard disk. Personally, I am against this practice as it removes functionality from, and messes with the user’s browser (something users don’t like). Additionally, it won’t stop the people who really want to steal from downloading your images, etc by other means. Matt Mickiewicz expressed similar thoughts in his article titled Copyright For The Webmaster, as did Rosie Wise in Don’t Disable Right Click.

    Other than taking a technical approach, you can take a social approach and contact those “friends” who have copied your work and ask them to stop using it. Remember: copying another’s work is illegal. It’s up to us Webmasters, designers, developers and Internet professionals to stick up for ourselves – “copying”, a.k.a. IP theft, is not ok.

    That’s it for this week! Spread the love!
    Dr. Design.

    Got a problem? A query? A question? Email Dr. Design today!