Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Could you elaborate on the loader code bug?


Pretty print their loader JS that is quoted in the url above. I like using the Developer Tools in chrome to do it for me: Load up that JS, go to the Sources tab and click on the {} near the bottom of the screen to auto format it for you.

The issue is that you can't insert b (the <script> tag) into the DOM until you've declared window.mixpanel because the code within mixpanel.2.js depends on window.mixpanel to be defined.

It is a subtle race condition that only seems to happen with IE, but when it would fail, it would cause one of those ugly IE dialogs to popup to the end user. Not good.

The correct code should look like this near the end... just move the insertBefore to be after the window.mixpanel:

a.__SV = 1.1; window.mixpanel = a; d.parentNode.insertBefore(b, d);




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: