Replace window.onload with jQuery alternative

6.76K viewsIssues
3

Hi,

This is David from the WPML compatibility team. Im writing about a problem we found when using WPML with your plugin which was initially reported here:

https://wpml.org/forums/topic/wpml-doesnt-recognize-french-as-a-separate-language-in-menus/

The problem is that you are manipulating window.onload directly in ap-admin.js. This can lead to compatibility problems with other plugins. In general, its a good idea to avoid assigning functions directly to onload.

You are already using jQuery, why not use its method instead?

jQuery( window ).load(function() {
// Run code
});

Let me know if you are willing to include this fix to provide our common users with a smoother experience.

Best,

David García Watkins
WPML Compatibility Team
OnTheGoSystems
The makers of WPML, Toolset and ICanLocalize

0

I still see window.onload still being used here:

https://github.com/anspress/anspress/blob/4.1.0/assets/js/ap-admin.js#L23

commented on answer

Ah, I misunderstood. Now its fixed.

You are viewing 1 out of 3 answers, click here to view all answers.