Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7403065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:57:30+00:00 2026-05-29T04:57:30+00:00

In my html page i have code something like this, where i have installed

  • 0

In my html page i have code something like this, where i have installed an extension only if the browser is Firefox:

if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent))
{
  //relevant code
  InstallTrigger.install(InstallXPI);
}

It works fine in every browser. But when the same page is used through htmlunit framework and using browserversion.FIREFOX_3_6 argument in webclient. It shows an error there:

com.gargoylesoftware.htmlunit.ScriptException: Wrapped 
com.gargoylesoftware.htmlunit.ScriptException: Wrapped 
com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "InstallTrigger" is not defined.

Any idea about this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T04:57:33+00:00Added an answer on May 29, 2026 at 4:57 am

    This is a reminder for you: don’t use browser detection, use feature detection. The issues with your code:

    • InstallTrigger is a feature of the Gecko engine, not Firefox. You are explicitly looking for “Firefox” in the user agent string however and might exclude other browsers based on the Gecko engine (there are e.g. SeaMonkey, K-Meleon, Camino).
    • User agent strings can be spoofed which is apparently what htmlunit is doing – it claims to be Firefox despite using a different browser engine. Your code will run into trouble then.

    Here is how you would do it properly:

    if ("InstallTrigger" in window)
    {
      // Gecko platform, InstallTrigger available
      InstallTrigger.install(InstallXPI);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code that looks something like this: <html> <head> <script type=text/javascript src=http://code.jquery.com/jquery-latest.min.js></script> <script
I have the following Javascript code add_num = { f: function(html, num) { alert(this.page);
I have code, that looks something like this: (function($) { $(document).ready(function() { function getHash(){
I have an xml file which I imported in my html page like this:
The JavaScript code window.print() can print the current HTML page. If I have a
I have a jQuery scrollbar in a static html page. The code works fine
I have the following HTML Code <%@ Page Language=C# %> <html> <head> <title></title> </head>
I have a code setup something like below, the image is part of a
We have some html that looks like this: <form id=MyUserControl runat=server method=post> <script language=javascript
I have this code in my view page. <td> Mandate Name: </td> <td> <%=

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.