javascript - "InstallTrigger" is not defined -



javascript - "InstallTrigger" is not defined -

in html page have code this, have installed extension if browser firefox:

if (/firefox[\/\s](\d+\.\d+)/.test(navigator.useragent)) { //relevant code installtrigger.install(installxpi); }

it works fine in every browser. when same page used through htmlunit framework , using browserversion.firefox_3_6 argument in webclient. shows error there:

com.gargoylesoftware.htmlunit.scriptexception: wrapped com.gargoylesoftware.htmlunit.scriptexception: wrapped com.gargoylesoftware.htmlunit.scriptexception: referenceerror: "installtrigger" not defined.

any thought this?

this reminder you: don't utilize browser detection, utilize feature detection. issues code:

installtrigger feature of gecko engine, not firefox. explicitly looking "firefox" in user agent string , might exclude other browsers based on gecko engine (there e.g. seamonkey, k-meleon, camino). user agent strings can spoofed apparently htmlunit doing - claims firefox despite using different browser engine. code run problem then.

here how properly:

if ("installtrigger" in window) { // gecko platform, installtrigger available installtrigger.install(installxpi); }

javascript firefox htmlunit

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -