Mahesh
Mahesh

Reputation: 127

jQuery 2.x issue on addEventListener while using Microsoft Web Browser OCX control

I am using IE OCX on Progress ABL container and has forced the emulation of IE10 by adding a new DWORD entry on windows registry(on FEATURE_BROWSER_EMULATION). The web file I want to open on this embedded browser includes jQuery version 2.2.4 and I am getting the script error:

Line: 3573 [document.addEventListener( "DOMContentLoaded", completed );],
Char: 4,
Error: Object doesn't support property or method 'addEventListener'
Code: 0,
URL: filepath/jquery-2.2.4.js.

The same error persists even if i force the emulation of IE11 and use jQuery 2.x. But no error if I use jQuery 1.12.4. Emulated version is correct. Is that the issue of Microsoft web browser ocx? I have IE11 on my machine.

Any help would be appreciated! Thank you!!

Upvotes: 2

Views: 710

Answers (2)

Mahesh
Mahesh

Reputation: 127

The FEATURE_BROWSER_EMULATION does change the userAgent. But i found the doctype specification on my old webpages like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> was compelling the browser to render the page in quirks mode and hence the error on jquery was occured. So i found 3 ways to resolve this issue (to ensure the standard mode):

  1. Using <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. Using '<!DOCTYPE html>' and following html5 standards for new webpages
  3. Specifying the metatag:<meta http-equiv="X-UA-Compatible" content="IE=Edge">

This is also quite helpful: doctype overview

Upvotes: 2

Rory McCrossan
Rory McCrossan

Reputation: 337627

You will need to use the 1.x branch of jQuery, as the 2.x branch removed a lot of legacy code which was required for compatibility with older browsers and IE (which is what the OCX control will be using)

Upvotes: 0

Related Questions