0

Our site has a pretty basic bookmarklet feature, that users can use to post any link from any other web site to their profiles with us. It inserts some overlays, all of which are position: absolute and have some comically high z-index number, so it's almost always going to appear above any other site's content.

This, however, doesn't seem to work when a user is on YouTube, and clicks the bookmarklet to share this to our site. Because YT's internal video player, just the player itself, now takes the highest z-index, no matter what. The rest of the page behaves, just the video player, now overlays all the bookmarklet's inserted content.

This seems to happen in every version up to IE10, and even on Firefox on Linux/Ubuntu. I've read a lot of solutions which describe editing the YouTube embed code to fix the issue. Obviously, this can't happen when you're on YT itself instead of embedding. (Or can it?)

If helpful, here is the bookmarklet code.

    javascript:(function(){

    var d=document.createElement('div');
    d.setAttribute('id','mySite-url');
    d.innerHTML='https://www.mySite.com';
    d.style.display='none';
    document.body.appendChild(d);

    var e=document.createElement('script');
    e.setAttribute('type','text/javascript');
    e.setAttribute('charset','UTF-8');
    e.setAttribute('src','https://www.mySite.com/js/bookmarklet.js');
    document.body.appendChild(e);

    })();
  • Weird, did you try to put a max int value to your z-index and check if it is of help? – Fabrício Matté Apr 03 '13 at 22:27
  • The z-index is in the billions (10 digits long), doesn't help. – Remix Sakura Apr 03 '13 at 22:58
  • Random shot but try setting it to around 2 millions (`2147483647` is the maximum int32 value and some browsers have issues handling values larger than that), though I have no idea how YT can overcome that. – Fabrício Matté Apr 03 '13 at 23:00
  • Oh, interesting, that must have been what the previous developer was thinking - the z-index values were 2147483640 for the BG and 2147483641 for the content. Sadly, not even that is high enough to make YT behave, but thanks for the tip. – Remix Sakura Apr 03 '13 at 23:32

0 Answers0