locked
How to check window pop up is opened are not using jquery RRS feed

  • Question

  • hello,

    can any help me on this.

    How can we check window popup is opened are not using jquery and if popup is open again if we click how to focus  on same window popup.

    Monday, December 7, 2015 9:35 AM

Answers

  • Hi Muzaffar,

    JavaScript is executing in the scope of one separate window, seems that there is no directly method to access other windows.

    According to your description, I assume that when user clicks a button, a window will pop up, you want to focus on the first window if there is not only one window being popped up.

    If this is the case, a suggestion is that, maybe you can change the logic of your script to make it only allow one window to be popped up at a time, set focus on controls in the page which is open in the new window.

    By doing this, user clicks a button, a window pop up. User finishes the job in the window, close it and get back to the original page to open another windows.

    It would be better if you can provide more details about your requirement, let’s see if there is already workaround exists.

    Best regards

    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    • Proposed as answer by Dennis Guo Friday, December 25, 2015 9:08 AM
    • Marked as answer by Dennis Guo Monday, December 28, 2015 2:17 AM
    Sunday, December 20, 2015 8:18 AM

All replies

  • What Window Popup are you referring? Is it the window.open or SharePoint Modal Dialog?

    I assume you are talking about SharePoint Modal Dialog since you post this quest to SharePoint forum.

    By executing

    SP.UI.ModalDialog.showModalDialog({url:'/_layouts/15/settings.aspx'});

    You can get back the dialog object via script below

    var dialog = SP.UI.ModalDialog.get_childDialog();

    and with the dialog, you can further check the URL or the Element (for advanced checking) via

    dialog.get_url();
    
    dialog.get_dialogElement();



    Cheng


    • Edited by AhCheng Monday, December 7, 2015 10:01 AM
    Monday, December 7, 2015 10:00 AM
  • Hello

    i am using the window.open popup

    Monday, December 7, 2015 11:39 AM
  • Hi Muzaffar,

    JavaScript is executing in the scope of one separate window, seems that there is no directly method to access other windows.

    According to your description, I assume that when user clicks a button, a window will pop up, you want to focus on the first window if there is not only one window being popped up.

    If this is the case, a suggestion is that, maybe you can change the logic of your script to make it only allow one window to be popped up at a time, set focus on controls in the page which is open in the new window.

    By doing this, user clicks a button, a window pop up. User finishes the job in the window, close it and get back to the original page to open another windows.

    It would be better if you can provide more details about your requirement, let’s see if there is already workaround exists.

    Best regards

    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    • Proposed as answer by Dennis Guo Friday, December 25, 2015 9:08 AM
    • Marked as answer by Dennis Guo Monday, December 28, 2015 2:17 AM
    Sunday, December 20, 2015 8:18 AM