Is there a way to hide window properties?

I ran across a website today, http://www.riverfronttimes.com/, I found something very interesting about it that boggled my mind. I had to ask you guys about it.

What was interesting was that I couldn't get window height and width properties on it. For example:

$(window).width();
$(window).height();

I kept getting an error:

VM1733:2 Uncaught TypeError: $(...).width is not a function(?)

Why am I getting this, are the properties hidden? Can I do this for my websites? Is there anything advantageous about this?

I've even tried using pure javascript but couldn't get the height and width.

It's got me so curious.

Thanks for the info.

Answers 1

  • You're assuming the $ available on that page is jQuery but it isn't. If it were, you could do $.fn.jquery from the console and get a version.

    While they do have jQuery loaded on the page, $ isn't bound to it. This can be seen by entering $ === jQuery which returns false. Normally, it'd return true.

    If you want to use their jQuery, you could do something like:

    jQuery(window).width();
    

Related Articles