Skip to content

Instantly share code, notes, and snippets.

@nickbarnwell
Last active May 10, 2016 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickbarnwell/d5192457cb1851fd620daea4961fe023 to your computer and use it in GitHub Desktop.
Save nickbarnwell/d5192457cb1851fd620daea4961fe023 to your computer and use it in GitHub Desktop.
function postMessageAndHashbang(obj) {
var msg = "";
if(typeof obj === "object" && obj.smsupsell.postmessagevalue != null) {
msg = obj.smsupsell.postmessagevalue;
} else {
msg = obj;
};
parent.postMessage(JSON.stringify({smsupsell: {postmessagevalue: msg}}), "*");
history.pushState({}, "", "#!"+msg);
window.location = window.location; //Don't ask…
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment