Forum Moderators: open

Message Too Old, No Replies

Closing framed window without warning popup

Feels like beating my head against a wall

         

toomer

11:52 pm on Apr 13, 2006 (gmt 0)

10+ Year Member



Hi ....

Wondering if anyone can help out with a project I'm working on. I'm a bit new to actually doing client-side stuff (most of my dev. is back-end, .NET, ASP etc.) so I'm a bit rusty on Javascript.

Here's what I'm trying to accomplish ...

1. User is on a page of link items. Let's call it "First page". From there, they click on an item - which launches a new page .... represented in its simplest form, it would look like this.


<HTML>
<BODY>
<a href="frametest.htm" target="_blank">Click here for the story!</a>
</body>
</html>

Ok, so now a new window has opened up and that new window is on the frame page....

2. The frame page has two portions - the primary content (the lower portion) and an upper bar like you see on about.com and google image search ....


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<HTML>
<HEAD>
<TITLE>A simple frameset document</TITLE>
</HEAD>
<FRAMESET rows="150, *">
<FRAME name="topbanner" src="topbanner.htm">
<FRAME name="bottomarticle" src="http://www.google.com">
</FRAMESET>
<NOFRAMES>
This is what you get if you can't support frames...
</NOFRAMES>
</HTML>

Ok - so now we should have two windows ... our original window, and this new framed window with 'topbanner.htm' on the top, and (in this example) google.com on the bottom.

3. Simplifying the top frame portion, one of the elements I want to have up there is the ability to close the framed page ... but do so by kicking off to another page first where I can write an entry to a DB indicating that a user did a close from the upper (framed) bar. So, here's topbanner.htm ...


<HTML>
<BODY>
<a href="closewindow.htm">Click to Close!</a>
</BODY>
</HTML>

4. Once the user clicks "Click to Close!" I want to have the top frame quickly load closewindow.htm - which I would use to write an entry into the database, and then just close out the whole window.

I managed to get all of that working, but I get the ANNOYING "To help protect your security, Internet Explorer has restricted this file from showing active content that could access your computer. Click here for options..." message that pops up in IE. If I select to "Allow Blocked Content" and click on "Click to Close!" again, it works and the window closes.

Here's closewindow.htm -- very simple....


<HTML>
<BODY>

<script type="text/javascript">
<!--
window.opener = this
top.window.close()
//-->
</script>

</BODY>
</HTML>

Basically, everything is working just perfect --- except for that annoying pop-up. I've seen plenty of web sites with javascript enabled "Close" actions, and none of them toss this warning out. What am I missing here?

Much thanks in advance!

milanmk

3:46 am on Apr 14, 2006 (gmt 0)

10+ Year Member



Did you try it online? If this error is showing up only when you are offline then i think Active Content is the reason behind it.

To control notification when active content is run from My Computer, follow these steps:
1. Click Tools, and then click Internet Options.
2. Click the Advanced tab.
3. Click to clear the Allow active content to run in files on My Computer check box.

toomer

4:28 am on Apr 14, 2006 (gmt 0)

10+ Year Member



D'Oh!

Wow - don't I feel like a jackass....

I knew it must have been something simple I was overlooking. Like I said, don't do so much on the client-side these days.

Thanks a ton milanmk, worked like a charm!

milanmk

5:06 am on Apr 14, 2006 (gmt 0)

10+ Year Member



You are most welcomed.