1

I am using below code to call function.

 window['GetTeenovationvideo']();

This function is executing in all browser but not in IE8.

In IE8 i am getting below error.

Object doesn't support property or method 'GetTeenovationvideo'

Am i doing something wrong? Or is there any alternative way to do this.

Manish Gupta
  • 97
  • 1
  • 7
  • 3
    any reason you're not just doing `GetTeenovationvideo()`? – Thom Porter Mar 20 '13 at 11:36
  • 1
    Does `GetTeenovationvideo()` or `window.GetTeenovationvideo()` work? If not, I can understand `window["GetTeenovationvideo"]()` doesn't either. – John Dvorak Mar 20 '13 at 11:37
  • can u post your GetTeenovationvideo() code? – sasi Mar 20 '13 at 11:38
  • @sasi not sure it would help – John Dvorak Mar 20 '13 at 11:38
  • Can you provide a [fiddle](http://jsfiddle.net) so that we can test? – John Dvorak Mar 20 '13 at 11:39
  • @ThomPorter because he want's to call the function through a variable, e.g. `window[myvar]();` – Simon Mar 20 '13 at 11:40
  • What are you assigning in window['GetTeenovationvideo']. – Yograj Gupta Mar 20 '13 at 11:45
  • @simon ah yes, that is the title isn't it! lol.... I wonder if perhaps it is supposed to be "GetTeenovationVideo"? – Thom Porter Mar 20 '13 at 11:46
  • It works fine for me in IE8, see http://tinker.io/f8a82/1 , so probably you are not assigning well a function to your `window["GetTeenovationvideo"]` variable.. – Nelson Mar 20 '13 at 11:47
  • GetTeenovationvideo = function GetTeenovationvideo(data) { $.wdpluginMiChallenge.GetTeenovationvideo(data); } this is the function.. – Manish Gupta Mar 20 '13 at 11:47
  • if i am calling GetTeenovationvideo() from console then also i am getting error "The value of the property 'GetTeenovationvideo' is null or undefined, not a Function object" but working fine on other browsers – Manish Gupta Mar 20 '13 at 11:48
  • From your last comment I assume that `$.wdpluginMiChallenge` has not been initialized properly, thus not having the `GetTeenovationvideo` function property. So the problem in IE8 does not lie in your call but the plugin. To test this, rename your function to something other than "GetTeenovationvideo" and call `window['yourfunction']()` – Simon Mar 20 '13 at 11:50
  • have you tried eval(window['GetTeenovationvideo'])(); – user991554 Mar 20 '13 at 11:57
  • 1
    Ouch! [don't use eval](http://stackoverflow.com/questions/86513/why-is-using-the-javascript-eval-function-a-bad-idea)! – Simon Mar 20 '13 at 11:58

0 Answers0