Firefox treating new iframe src as popup from jquery .click() trigger -


i have 2 forms, , trying submit them both @ same time. 1 posting our php framework, , other posting external system (a prestashop install) seems require user "visit" page through normal click submit of form process form.

my solution is, fire 1 form after firing other

$(document).ready(function() {     $('#loginform2').hide(1);     $("#loginbutton").click(function() {         $("#useremail2").val($("#useremail").val());         $("#userpassword2").val($("#userpassword").val());         $.post(             $("#loginform").attr("action"), $("#loginform").serialize(), function(data) {                 // alert('posted users/login successfully');                 $("#submitlogin").click();             }         );         return false;     });     function refresh() {         location.reload();     } }); 

the #loginform2 form being sent hidden iframe on same page, , iframe refreshes after has loaded page (and logged in user).

<iframe id="loginiframe" style="display:none;" onload="refresh();"></iframe> 

this works great in chrome , safari, in firefox, treats iframe popup , won't (unless user says allow popup).

is there way around firefox thinking iframe popup? understand why it's doing it; it's not real event user clicked, it's fake mouseclick jquery. i've looked solutions try , fire "authentic" mouseclick haven't found seems work.

here's solution:

make you're clicking external system (prestashop) form's submit button instead of primary system's login button (use css hide primary 1 , show external one). this:

    $("#submitlogin").click(function() {         var loaded = 0;         $("#useremail2").val($("#useremail").val());         $("#userpassword2").val($("#userpassword").val());         $.post(             $("#loginform").attr("action"), $("#loginform").serialize(), function(data) {                 loaded++;                 if (loaded > 1) {                     location.reload();                 }             }         );         $('#loginiframe').load(function() {             loaded++;             if (loaded > 1) {                 location.reload();             }         });     }); 

the loaded variable ensure if prestashop window loads before primary login's serialized data sent, doesn't refresh without finishing primary login.

and obviously, iframe looks this

<iframe id="loginiframe" name="loginiframe" style="display:none;"></iframe> 

tested in chrome firefox , safari.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -