Skip to content

Instantly share code, notes, and snippets.

@susanahernandezd
Created July 1, 2013 07:55
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 susanahernandezd/5899070 to your computer and use it in GitHub Desktop.
Save susanahernandezd/5899070 to your computer and use it in GitHub Desktop.
Know parent URL of iframe
$(document).live('click', '#cupon_danet3D', function(event){
var re = /(.*)danet(.*)/g,
//url = document.referrer,
url = document.location.ancestorOrigins[0],
matched = url.match(re);
if(matched){
event.preventDefault();
var urlCupon = $('#cupon_danet3D').attr('href'),
paramDanet = '?utm_source=Danetiframe&utm_medium=Banner_Cupon&utm_campaign=Imprime_Cupon_Productos';
window.open(urlCupon+paramDanet);
}
//console.log('HEI: '+matched);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment