Settings active tab error (cause problem with other plugins)
-
I found a problem in my site with this plugin that makes other plugins to stop working due a javascript error.
The problem comes in the settings.js when trying to detect the active tab (at the beginning of the file) it reads it from localstorage using key “activetab”:
activetab = localStorage.getItem("activetab");
as activetab is a generic name I think it was written in other plugin and read here. Then the value of activetab is not any jquery valid id. Making the line
if (activetab != '' && $(activetab).length ) {
to fail and stop javascript execution.
I set a workaround for that:
... if (typeof(localStorage) != 'undefined' ) { activetab = localStorage.getItem("activetab"); } // <XWOLF> test localstorage is jquery valid try{ $(activetab); }catch(e){ activetab=''; } // </XWOLF> if (activetab != '' && $(activetab).length ) { $(activetab).fadeIn(); } else { ...
I also recommend to use some prefix for this plugin on the local storage to avoid name collision.
- The topic ‘Settings active tab error (cause problem with other plugins)’ is closed to new replies.