Link to home
Start Free TrialLog in
Avatar of fpoyavo
fpoyavoFlag for United States of America

asked on

Button page refresh

Hi Experts,

I have button on my page which has this code

$('#Button1').click(function() {
                location.reload();
            });

The problem is that in IE8-9 it prompts popup if I would close this tab.

Is there workaround this issue ?

Thanks.
Avatar of Gary
Gary
Flag of Ireland image

What does the prompt say?
prompts popup if I would close this tab
Are you reloading the page or closing it?

Instead of location.reload() try
window.location.href = window.location.href
I don't the prompts popup on the following link : http://fiddle.jshell.net/6Ux2F/1/show/

And you?
Avatar of fpoyavo

ASKER

Gary,

Same thing. "The page you are viewing is trying to close this tab. Would like to close or continue?"

That's odd....
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fpoyavo

ASKER

Yes I do. It actually closes child windows but why do you think they are related ? if so how do I keep both ?
Avatar of fpoyavo

ASKER

You are right man !!!
It's nothing to do with the page you are reloading, its the child windows closing that is firing the alert.
That's not really an answer...
What you would need to do is close the child windows in the button click code, then you shouldn't get any alerts.
Avatar of fpoyavo

ASKER

I have no opened child windows at the time when I click this button to refresh.