ie11 "webpage you are viewing is trying to close this tab"


i thought I had found a solution to my popup problems (now trying to close the popup as a new page is opened from inside it) by using either

<a href=url" onclick="closeWin()" target="_blank">   

    function closeWin()


 <a href="url" onClick='setTimeout("self.close();",1)' target="_blank">

They both do exactly what I want them to, execpt that in Internet Explorer I get the panel as in the title.

I found a page with a possible solution but cannot understand how it could help me

is there a solution for this, please?

Well, you could try this attachment example… (3.2 KB)



I just looked at the examples but they don’t seem to do what I need (or rather needed because I am coming to accept that it is either impossible or very difficult.

These popups are part of full pages. I need them to close when a visitor clicks on the adverts WHEN IT IS A POP, but NOT CLOSE when the page is accessed directly, i.e. full page

is this possible?

Maybe I did not understand your examples too well. I’m on my way out, I will lok at them later this evening~~thanks

That is exactly what the example does. :unamused:

Maybe, you did not. :grimacing:

Nothing unusual about that though, :sunglasses:


Now, now…

I’m still here, for another few secs and had a look at the script.

Is the following what does the trick? I take it that it can understand if it is a full page 0,0 , or otherwise

Is that it?


Nothing’s impossible with you!

No, the commented out lines give this…

" newwindow is not defined"

…in the Error Console. :cold_sweat:

I just added this to your script…

document.getElementById('logo-close').onclick=function() { window.close(); };


Hi coothead

Brilliant…as always!

Two questions:

I have not gone through the new code exhaustively, but if I only touch the script and not the html and delete the

the popup goes up to the top left hand corner, forcing me to replace the deleted code and using the coordinates to get the popup in the centre . I did not need this before,

I noticed that you added

<!--************************  added to make javascript work  *****************************-->
<div id="left"></div><div id="right"></div><div id="box4"></div><div id="head"></div>
<div id="nav"></div><div id="horizontal2"></div><div id="footer"></div><div id="header"></div>

It does not seem to be needed to get the popups to work. Was this only for your example?

That was for the popups

Now, if I simply paste the popup url into the address bar I get the full page. If I then press the advert link the new page opens as it should leaving my page below. Good! But…the IE11 panel is still telling me that

“the webpage you are viewing is trying to close the page”, as before


Question One :arrow_heading_down:

Answer One :arrow_heading_down:

I do not know where you got or from whom you got…


…but both lines cause script errors. :ng:

That is why they were commented out… :mask:

Be aware that “newwindow” is just the name of the window not the object itself, and
is used in the script to test whether the window was opened by javascript or not…

   if('newwindow') {

If you do not want the window moved to the top left, then just remove the…


Question Two :arrow_heading_down:

Answer Two :arrow_heading_down:

The javascript has…

var left=document.getElementById('left'); var right=document.getElementById('right'); var box4=document.getElementById('box4'); var head=document.getElementById('head'); var nav=document.getElementById('nav'); var horizontal2=document.getElementById('horizontal2'); var footer=document.getElementById('footer');
…and will throw errors if those elements are not in the HTML. :ng:

As I have added this to script…

document.getElementById('logo-close').onclick=function() {

Do not forget that something similar to this…

<a id="logo-close" href="someOtherPage.html" target="blank" title="go to page three"> <img src="" alt="tiny logo"> </a>
…is actually required in the HTML to prevent further script errors. :ng:



I’ll get right on it!


if not sooner. :grinning:

Hi coothead

Did as instructed, but…

bloody thing is still there

Just place the full url in the address bar in IE11 and the press the bottom link, and then close that page. My page should stay (it does) but I want to get rid of the box, as per my first post in the thread.

This might have to do with the way the link is redirected…

…and where did the extra Pinto Tours logo come from…?

Hi there qim,

have you ever considered a hobby other than coding. :sunglasses:

It’s a shame, but you really do not seem to have a natural talent for it. :mask:

Are you absolutely certain about that? :cold_sweat:

If you go to line #443 of your ParaPalma.html file you will find this gem…

<a id="logo-close" href="/request/index.php?id=Pinto" onClick='setTimeout("self.close();",1)' target="_blank">
…which is guaranteed to produce the “Windows Internet Explorer” dialogue box. :smiling_imp:

Snipping required, go for it. :scissors: :ok:

Well, I certainly did not put it there. :confused:

Is it possible that you may have had a hand in it? :hand:


Hi coothead

I was about to post to apologize for not having deleted that code from the page. I had just found out the error and it works!

As for the logo, no idea! Could it be due to logo-close and the fact that I have divs named logo?


Also the popup is now much higher than it should be. before it depended on the data-dimensions but now I cannot control it from there

i deleted the focus code from the script but it made no difference


Hi coothead

Apologies again!

I had left your full code inside the html file in order to copy what I needed and left it there.

Mystery logo’s gone!

Did you see above the remaining prob with the height of the popup?

oooh that hurts :smile:

He doesn’t understand that easy things are no fun! Besides, we have a long relationship that transcends this forum.

On the positive side a lot of my site exists, thanks to him, and later to you, …and some other forum contributors

Re the “trying to close” dialog
AFAIK this is because JavaScript is trying to close a window that was not opened by JavaScript

I believe part of the problem is because you are not using pop-ups for temporary “help info” type of stuff hat would be read and closed, but for what should be pages in their own right, or perhaps in show-hide toggles. but not pop-ups

Hi Mittineague

I think that problem has now been solved by some magic from coothead…

I have another problem in HTML/CSS, if you could have a look?..


Sorry, which one? You seem to always have one or more you’re working on.
(the whac-a-mole effect as result of working per page but evaluating per site. IMHO a templating system or at least include()s would help)


I managed to sort that one one myself (amazing!..)

And even more amazing I have NO threads going. Hopefully for while to give you all some rest!


1 Like