0

enter image description here

I have a visualforce page with showheader set to true. But I see the page rendering with the tabs in header not wrapping

  • Are you using jquery document event in page – Tushar Sharma Jun 9 '16 at 17:26
  • @Tushar Sharma No I am not using jQuery . Though I have standard JS window.onload = function() {} – nevrekar_amey Jun 9 '16 at 17:30
  • Using window.onload will break the standard onload function. Use window.addEventListener instead. – sfdcfox Jun 9 '16 at 17:31
  • Good to know. Thanks sfdcfox and Tushar Sharma for quick turnaround – nevrekar_amey Jun 9 '16 at 17:40
4

When you use this structure, you overwrite any existing listeners:

window.onload = function () { }

Instead, look at best way of unobtrusive onload in plain javascript:

document.addEventListener("DOMContentLoaded", new function (){}, false);
  • There's really no need to mention attachEvent, as no browser that salesforce supports supports attachEvent, and not addEventListener... – sfdcfox Jun 9 '16 at 17:36
  • Ah didn't realize it doesn't apply to 9+. @sfdcfox – Adrian Larson Jun 9 '16 at 17:37
  • @Adrian Larson That solves the issue. – nevrekar_amey Jun 9 '16 at 17:40
  • @AdrianLarson We are finally out of the stone ages of browsing... and it only took a decade or so. – sfdcfox Jun 9 '16 at 17:42
  • I was so excited when they finally dropped support for IE versions that should have been axed so many years sooner. At least it's done. – Adrian Larson Jun 9 '16 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.