Windtalker
Windtalker

Reputation: 796

JavaScript runtime error: Unable to set property 'WebKit' of undefined or null reference

I am working on asp.net and of course javascripts in front end.

I searched on Google but couldn't find the similar issue about "webkit",

BTW, I am using IE. I tried to debug on chrome, well part of my app works. I mean, the start page can be loaded but no more content and details appear. Looks like it only loaded the frame...

I even tried put a breakpoint at the beginning of my javascript code but this error still got popped up. I guess because of the js file?

This is what I use.

<script src="Scripts/jquery-1.10.2.js"></script>
<script src="Scripts/jquery-ui-1.10.2.js"></script> 

This is a weird issue that it appeared last week then disappeared without any modification! Then today it comes back again...

Thx in advance!

Upvotes: 0

Views: 3078

Answers (1)

Reinstate Monica Cellio
Reinstate Monica Cellio

Reputation: 26143

It's trying to determine whether or not you're using a webkit browser by checking the webkit property of the browser object. Unfortunately, that object was removed in more recent versions of jQuery as it's recommended to check for browser features, rather than browser type.

This will get rid of the error message, but will assume all browsers are not webkit browsers...

if (typeof ($.browser) == "undefined") {
    $.browser = {};
}
if (typeof ($.browser.webkit) == "undefined") {
    $.browser.webkit = false;
}

You'll need it after jQuery is included, but before whatever you're calling that's causing the error. It will probably suffice to put it at the top of your own first included script.

Upvotes: 2

Related Questions