Solved

Button page refresh

Posted on 2014-03-13
9
300 Views
Last Modified: 2014-03-13
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.
0
Comment
Question by:fpoyavo
  • 4
  • 4
9 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39928189
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
 
LVL 82

Expert Comment

by:leakim971
ID: 39928191
I don't the prompts popup on the following link : http://fiddle.jshell.net/6Ux2F/1/show/

And you?
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 39928208
Gary,

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

That's odd....
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39928219
Do you have any other javascript firing on page unload?

Does leakims example give you the same alert?
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 39928221
Yes I do. It actually closes child windows but why do you think they are related ? if so how do I keep both ?
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 39928224
You are right man !!!
0
 
LVL 58

Expert Comment

by:Gary
ID: 39928225
It's nothing to do with the page you are reloading, its the child windows closing that is firing the alert.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39928231
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
 
LVL 1

Author Comment

by:fpoyavo
ID: 39928282
I have no opened child windows at the time when I click this button to refresh.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question