Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Dec 2003
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need to open and close a new window automatically

    I've been trying to figure out some coding without any success. Basically, I want to be able to do two things. First, when a window opens (we'll call it window A) I want it to be able to automatically launch a second window (I'll call it window B).

    Second, once it launches Window B, I want window A to automatically close.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    On a website or on your local machine?

    If you're talking about a website the answer is "forget it", it's simply not possible and would be a rude thing to do to a user anyway.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    338
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is Window A a window created through JavaScript?

    Happy coding!

  • #4
    New Coder
    Join Date
    Dec 2003
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    The reason I need the code

    There are two reasons I was looking for a code that could do this. The first reason is because I need to know how often a document (PDF file) is being downloaded from my website (I have a couple dozen documents that people can download for free). My current tracking system (extreme tracking) does track every object that is accessed from my website. It only tracks pages that have their script in it. So I thought I could create a page that would be launched every time a document was downloaded. The page would send the script to my tracking company and then close immediately.

    The second reason is a project I am currently working on. I writing a simple program that works on stand alone computers (not on the Internet) and uses the browser as the main interface. To make it look more user friendly, I eliminated the tool bar, menu, scroll bars on most of the pages. I haven't, however, been able to eliminate it from the very first page.

    On all of the other pages I eliminated the toolbar etc., by defining what the NEW window will look like. However, I can't do that on the very first page. I am unaware of any code that would eliminate the toolbar etc. from itself. If you know of some way of doing this I would greatly apprecite you showing me.


    Thanks for taking the time to respond

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,946
    Thanks
    0
    Thanked 236 Times in 233 Posts

    Is this what you wanted?

    How is your tracking script set up? I mean, do you pass the document's url in the tracker script?

    <script type="text/javascript">
    function keepTrack(docFile){
    var tracker = new Image();
    tracker.src = "trackerscript.xxx?file=" + escape(docFile);
    }
    </script>


    HTML:

    <a href="pdfdoc.zip" onclick="keepTrack(this.href)">Download PDF1</a>

    <a href="pdfdoc2.zip" onclick="keepTrack(this.href)">Download PDF2</a>

    The tracker script will be executed in the background and no more new windows needed. In the tracker script, you just access the file querystring to get the downloaded file's url.

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It really, really helps when you explain why you want to do something. If your desires are reasonable it motivates us to give you assistance.

    For the Local application try renaming the starting page from .HTM to .HTA. The .HTA extension will give you the ability to control all of those chrome elements right on the first page.
    http://msdn.microsoft.com/library/de...node_entry.asp


    You should contact your web hosting service to see if they will provide you with the log file information for your site. If they will provide that it gives you a lot better tracking of hits than the script based one you're using now. If they won't provide logs you can set up the PDFs as embedded objects in pages so that your script will run when the page is loaded and the PDF is embedded therein.

    <object type="application/pdf" width="xx" height="yy">
    <param name="SRC" value="url of document">
    </object>
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #7
    New Coder
    Join Date
    Dec 2003
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do I put the script in the function

    Thanks for helping me with the advice on solving a website tracking problem. I appreciate you taking the time. In your response, you had asked how the tracking script was set up.

    Basically, the tracking script is over nine lines long. Unfortunately, each web page (or in the situation: PDF document) has to have a its own separate script. I've included a sample of the script below for a web page called melt.htm

    I don't think the large tracking scripts will cause any major problem. I just wanted to confirm that I incorporated your code correctly.


    PS, The tracking script is sent to me by the tracking company. I simply tell them the web page I want tracked and they send me the complete script. I don't have to do any editing with a boilerplate script.

    PPS, The only thing that concerns me about incorporating your coding with the tracking script is the declarations of <script> in the coding. The tracking company uses <script> and <noscript> multiple times. Will that interfere with the computer knowing where your function ends?



    *********YOUR CODE INCLUDED WITH MY TRACKING SCRIPT




    <script type="text/javascript">
    function keepTrack(docFile){
    var tracker = new Image();




    <script><!--
    an=navigator.appName;sr='http://x3.extreme-dm.com/';srw="na";srb="na";d=document;r=41;function pr(n) {
    d.write("<img src=\""+sr+"n\/?tag=bronson&p=http://BibleHelp.org/melt.htm&j=y&srw="+srw+"&srb="+srb+"&l="+escape(d.referrer)+"&rs="+r+"\" height=1 width=1>");}//-->
    </script><script language="javascript1.2"><!--
    s=screen;srw=s.width;an!="Netscape"?srb=s.colorDepth:srb=s.pixelDepth//-->
    </script><script><!--
    pr()//-->
    </script><noscript><img src=http://x3.extreme-dm.com/z/?tag=bronson&p=http://BibleHelp.org/melt.htm&j=n height=1 width=1></noscript>




    }
    </script>






    HTML:

    <a href="pdfdoc.zip" onclick="keepTrack(this.href)">Download PDF1</a>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •