0

I have a webpage which has the script tag as :

<script type="text/javascript" src="https://raw.github.com/joelpurra/emulatetab/gh-pages/dist/emulatetab.joelpurra.min.js"></script>

But when I try:

$.emulateTab()

I get:

TypeError: 'undefined' is not a function (evaluating '$.emulateTab()')

why?

I can see jquery is present, when I do $ I get:

function (a, b) {return new e.fn.init(a,b,h);}

why I couldn't able to call emulateTab()?

Whats wrong here?

sriram
  • 8,562
  • 19
  • 63
  • 82

1 Answers1

2

Github doesn't like when people uses sources in this way, see:

We added the X-Content-Type-Options: nosniff header to our raw URL responses way back in 2011 as a first step in combating hotlinking. This has the effect of forcing the browser to treat content in accordance with the Content-Type header. That means that when we set Content-Type: text/plain for raw views of files, the browser will refuse to treat that file as JavaScript or CSS.

I think this is a reason why this plugin doesn't work in your code.

Bu you can try link to this script using http://rawgithub.com/ resource like this:

<script type="text/javascript" src="https://rawgithub.com/joelpurra/emulatetab/gh-pages/dist/emulatetab.joelpurra.min.js"></script>

Notice that I removed ..

More info here: Hotlink resources like JavaScript files directly from GitHub

Community
  • 1
  • 1
Tony
  • 7,345
  • 3
  • 26
  • 34