Ifram get parent


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function get_root(obj, current_ref) {
  2. if(obj.parent.location.href != current_ref) {
  3. return get_root(obj.parent, obj.location.href);
  4. }
  5. else {
  6. return obj;
  7. }
  8. }
  9.  
  10. Usage: get_root(window, window.location.href).location.href

URL: www.tecnocrazia.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.