Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
JavaScript
$(document).ready(function () {
       var progressbar = $('#progress_bar');
       max = progressbar.attr('max');
       time = (10000 / max) * 5;
       value = progressbar.val();

       var loading = function () {
           value += 1;
           addValue = progressbar.val(value);

           $('.progress-value').html(value + '%');
           var $ppc = $('.progress-pie-chart'),
           deg = 360 * value / 100;
           if (value > 50) {
               $ppc.addClass('gt-50');
           }

           $('.ppc-progress-fill').css('transform', 'rotate(' + deg + 'deg)');
           $('.ppc-percents span').html(value + '%');

           if (value == max) {
            //   alert('It is over,Now Your session has Been Expire.Please Retry to completed this Process With in Time.');
               //window.location("http://www.bing.in");
               window.close();
               clearInterval(animate);

           }
       };

       var animate = setInterval(function () {
           loading();
       }, time);
   });
Posted
Comments
Sergey Alexandrovich Kryukov 8-Jul-15 1:44am    
What's wrong with reading JavaScript/DOM documentation?
Ah, you are calling window.close. Than this point in the code might not be reached as you expected. Just use the debugger.
—SA
Khushi Saraswat 8-Jul-15 1:54am    
I use Debugger and Code reaches this line dear
Sergey Alexandrovich Kryukov 8-Jul-15 2:00am    
But then your current window should be closed. Wasn't it?
—SA
Khushi Saraswat 8-Jul-15 2:03am    
NO,It did'nt close
Sergey Alexandrovich Kryukov 8-Jul-15 2:11am    
In fact... you are right, it won't always close. If it is one of the multiple tabs, it may not close. This function is usually used for solitary pop-up windows. Generally, it's not a good idea to close a current window (in other cases), and even closing any window is not the best idea, and finally, popups are not good. What do you want to achieve? Did you consider using modal popup?
—SA

1 solution

Please see my comments the the question and thank you for the clarification:
Khushi Saraswat wrote:
Actually I have a career page there student can apply but there is a progressbar in this interval if it will not fill all details than window will close after alert.
It's hard to invent more unfriendly, even hostile behavior! Imagine the user's frustration, who maybe filled in most of the data correctly, and, due to one little mistake, you cancel all her/his work. With such aggression against your users, I would rather advise you to rethink your own career. :-)

More generally, even though window.close() can really close a browser window in some cases, I cannot see many valid scenarios when it would be acceptable. In your case, you should do something nearly opposite to what you are trying to do: you need to validate the data and mark every invalid item with some content explaining the problem. Leave all the data entered by the user intact, but disable your "Submit" button. Re-enable it on any change in the entered data. Give the user a chance to change just some of the data and submit again.

—SA
 
Share this answer
 
v3
Comments
Suvendu Shekhar Giri 8-Jul-15 2:48am    
5*. Perfect suggestion. Closing browser window is not the way to validate user inputs. I strongly recommend OP to consider this design.
Sergey Alexandrovich Kryukov 8-Jul-15 2:51am    
Thank you, Suvendu.
—SA
senthilnathan p 12-Jul-15 23:11pm    
just close the current open tab no progress bar interval in asp.net no progress bar only update progress.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900