Home > Software design >  form submit done as get when via facebook mobile in-app browser
form submit done as get when via facebook mobile in-app browser

Time:01-19

I have a few download links on a web page that use this js function to make a form post that will return a FileResult from the server:

function downloadFile() {
    var $form = $('<form method="post"/>').attr('action', 'downloadFileUrl').appendTo('body');

    $form.append("<input type='hidden' name='"   paramx   "' value='"   valx   "'/>");
    ...

    $form.submit();
    $form.remove();
}

and it works on desktop, on mobile browser apps,

except when you get to the page by clicking from the facebook mobile app (when there's no address bar),

instead of a POST a GET request is done.

anybody faced this problem before, is there a known solution ?

CodePudding user response:

It looks like facebook in-app browser will do the post and after without waiting for the result will switch/go to the default browser app with the url being what was in the form action attribute,

so knowing that I've added the necessary parameters to the form action

<form action="url?parm1=val1"...

and I've created a page for this url where I read the param1 and repeat the action.

  • Related