Midia handler for javascript