**Javascript** Fiddle : http://jsfiddle.net/RU2kA/1/ Code should be run from a html page enclosed within the `script` tag that has a `type` attribute var x = document.querySelector("script");alert(x.type.split("/")[1]);