I am working on integrating third party application with Salesforce. As part of integration to the third party, we have an anchor tag( tag) on visualforce page that makes a POST call. The way we do that is:
<a href="javascript:function1(a,b);">Click here</a>
<script>
function function1(a,b){
var form = document.createElement("form");
var element1 = document.createElement("input");
form.method = "POST";
form.action = uri;
form.target ="_top";
element1.type="hidden";
element1.name="Token";
element1.value=token;
form.appendChild(element1);
document.body.appendChild(form);
form.submit();
}
</script>
When the request hits the URI mentioned above as form action, it would internally redirect to the other Uri (which is handled by third party app entirely) - say URI2. In the first request's response, you get a validationtoken cookie which is to be sent with the next request.
This flow works completely fine on Salesforce Web as well as emulating Salesforce1 mobile theme in the browser using /one/one.app. Whereas while testing Salesforce1 on real devices, I am facing an issue wrt Android mobiles. When I hit the anchor tag on iOS device, a child window opens up within Salesforce that performs the above operation and passes on the validationtoken cookie from one response to the next request. When I hit the anchor tag on Android device, the link opens up in a mobile browser, outside of Salesforce1 app. As part of hitting the first URI, it receives a cookie in its response but doesn't send the received cookie along with its next request (tracked using Fiddler).
Any help would be appreciated. Thanks