0

I can't figure out how to block content in new page with jQuery BlockUI. I have application in aSP.NET MVC. In one view I click the button and new report is generated and opened in new tab/window and I want block this page content until report is not loaded. But in my case content is blocked on first page with button and not in this new one. Can someone help me how to do this, please?

<div>
    <button id="btnSubmit">Report</button>
</div>
<script type="text/javascript">
    $(function () {
        $('#btnSubmit').click(function () {
        $.blockUI({ css: {
            border: 'none',
            padding: '15px',
            backgroundColor: '#000',
            '-webkit-border-radius': '10px',
            '-moz-border-radius': '10px',
            opacity: .5,
            color: '#fff'
        }
    });
    setTimeout($.unblockUI, 5000);
    window.open(link, "Report");
    $(document).ajaxStart($.blockUI).ajaxStop($.unblockUI);
    return false;
</script>
Korl
  • 95
  • 3
  • 15
  • http://stackoverflow.com/questions/3841100/write-content-to-new-window-with-jquery – mikey Apr 30 '13 at 12:57
  • window.open actually returns a variable, you can use that variable to check if the new window was blocked by a popup, and if it was not, you can perform your ajaxStart/Stop block/unblockUIs – mikey Apr 30 '13 at 12:59

1 Answers1

0

May require some further debugging but this is the idea:

var w = window.open(link, "Report");
$(w.document).ajaxStart($.blockUI).ajaxStop($.unblockUI);
mikey
  • 5,090
  • 3
  • 24
  • 27
  • Mikey, thank you for the answer. I try your suggestion but I still don't see blockUI popup in new window - just in first one :( – Korl Apr 30 '13 at 14:35