Jump to content

Avoid popup blocker when opening new tab from Destination section of submission form


Recommended Posts

Hi,

I have a submission form that opens in an iframe in a FancyBox over a parent page. When the user submits the form the Destination has some code in it to open a new tab in the parent browser, with a new page. Sometimes there's no issue with a popup blocker but sometimes there is-and the user will rarely see the message in time to allow it. 

I realize that window.open can trigger a popup blocker unless it's user-triggered. The fact that this code is in the Destination section of the submission form must make it 'non-user triggered', I think, and so the popup blocker is engaged. 

Is there a way to open a new tab (in the parent section, not the iframe the submission form is in) from the Destination section that avoids a popup blocker? This is the current code: 

if(v_virt=="proposal"){

setTimeout(window.open('../../proposals/proposal?ProjectID=[@field:ProjectID]&ProposalID=[@field:ProposalID]&runnew=yes&cbResetParam=1','_blank'),1000);

setTimeout(window.parent.jQuery.fancybox.close(),2000);

}

Thanks for any help!

Link to comment
Share on other sites

  • 1 month later...
  1. To bypass potential popup blockers, consider using target="_blank" within the form itself (parent section) instead of window.open in the destination section. This triggers the user's explicit action and reduces popup blocker interference.

  2. Alternatively, explore window.postMessage for cross-window communication. The parent window can listen for the message and open the new tab, providing a user-initiated feel.

Link to comment
Share on other sites

Hi @foodblogger0919,

Thanks for the tip--though I'm not understanding your first suggestion. When you say use 'target_blank within the form itself and not the destination 'window.open', how does that work? Because it's only in the Destination section that the new ID numbers for the new record can be accessed, correct? I wouldn't be able to direct the page to a new destination with parameters from the record created, if I use a call from the form itself. Unless you mean something different? 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...