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.
LVL 1
fpoyavoAsked:
Who is Participating?
 
GaryConnect With a Mentor Commented:
Do you have any other javascript firing on page unload?

Does leakims example give you the same alert?
0
 
GaryCommented:
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
0
 
leakim971PluritechnicianCommented:
I don't the prompts popup on the following link : http://fiddle.jshell.net/6Ux2F/1/show/

And you?
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
fpoyavoAuthor Commented:
Gary,

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

That's odd....
0
 
fpoyavoAuthor Commented:
Yes I do. It actually closes child windows but why do you think they are related ? if so how do I keep both ?
0
 
fpoyavoAuthor Commented:
You are right man !!!
0
 
GaryCommented:
It's nothing to do with the page you are reloading, its the child windows closing that is firing the alert.
0
 
GaryCommented:
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.
0
 
fpoyavoAuthor Commented:
I have no opened child windows at the time when I click this button to refresh.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.