Engine23
blogBannerImage
By Engine23

Magento - How to fix error message: MediabrowserUtility is not defined

 error: error in [unknown object].fireEvent():

event name: open_browser_callback

error message: MediabrowserUtility is not defined 

Step 1: Add this to the adminhtml xml for the custom extension

<?xml version="1.0"?>
<layout>
<default>
<reference name="head">
<action method="setCanLoadExtJs"><flag>1</flag></action>
<action method="addJs"><script>mage/adminhtml/variables.js</script></action>
<action method="addJs"><script>mage/adminhtml/wysiwyg/widget.js</script></action>
<action method="addJs"><script>lib/flex.js</script></action>
<action method="addJs"><script>lib/FABridge.js</script></action>
<action method="addJs"><script>mage/adminhtml/flexuploader.js</script></action>
<action method="addJs"><script>mage/adminhtml/browser.js</script></action>
<action method="addJs"><script>prototype/window.js</script></action>
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
</reference>
</default>
</layout>

Step 2:

In the _prepareLayout() for your custom extension you need to add this

protected function _prepareLayout() {

 

if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
if ($head = $this->getLayout()->getBlock('head')) {
$head->addItem('js', 'prototype/window.js')
->addItem('js_css', 'prototype/windows/themes/default.css')
->addCss('lib/prototype/windows/themes/magento.css')
->addItem('js', 'mage/adminhtml/variables.js');
}
return parent::_prepareLayout();


}
}