...

View Full Version : Need to open and close a new window automatically



xbuddy
12-18-2003, 06:43 PM
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.

Roy Sinclair
12-18-2003, 09:21 PM
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.

nolachrymose
12-18-2003, 09:21 PM
Is Window A a window created through JavaScript?

Happy coding! :)

xbuddy
12-18-2003, 10:31 PM
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

glenngv
12-19-2003, 02:35 AM
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.

Roy Sinclair
12-19-2003, 03:43 PM
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/default.asp?url=/workshop/author/hta/hta_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>

xbuddy
12-20-2003, 11:00 PM
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>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum