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

  • SEARCH
  • Home
  • 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 8553299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:37:11+00:00 2026-06-11T14:37:11+00:00

Can i check whether if my javascript ext-lib such as fancybox plugin have already

  • 0

Can i check whether if my javascript ext-lib such as fancybox plugin have already existed in my page(don’t matter its version)?
I use liferay portlet, it can be place two same portlet in one page, I am already have some script confict now. (Liferay AUI script on layout configuration panel, slider in some assetPublisher …)

  • 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-06-11T14:37:13+00:00Added an answer on June 11, 2026 at 2:37 pm

    If you are testing for native javascript functions (i.e. built–in or created using javascript), then:

    if (typeof foo == 'function')
    

    will always work, regardless of which library you are using. e.g. to test if jQuery is available:

    if (typeof jQuery == 'function')
    

    I would not trust the jQuery isFunction method for host objects, and if you aren’t testing host objects, typeof is completely reliable.

    Edit

    Oh, I should add that if you are testing methods of host objects, there are many aspects to consider. The following is sufficient in the vast majority of cases:

    if (hostObject && hostObject.method) {
      // call hostObject.method
    }
    

    It’s worth noting that host objects aren’t required to comply with ECMA-262 (though most modern implementations do to a large extent, at least for DOM objects). There are a number of implementations in use that have host objects that, when tested with typeof will return “unknown” or similar, some older ones even threw errors.

    Some host objects throw errors if tested with object.prototype.toString.call(hostObject) (which jQuery’s isFunction function uses), so unless you are going to implement a robust isHostMethod function, the above will do in the vast majority of cases.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I check whether all JavaScript functions have loaded properly on a page?
can anyone help me in trying to check whether JavaScript is enabled in client
How can I check whether a particular element is inside an array? I don't
I want to use JavaScript (I can also use jQuery) to do check whether
I'm executing multiple(3) ajax requests. How can I check whether all of them have
the default login form in drupal doesn't have any javascript to check whether the
If I have a list in Python, I can check whether a given value
How can I check whether password match or not in primefaces + javascript? I
Does HTML5/JavaScript provide a function to check whether videos like .mp4 can be checked.
how can I check with javascript whether in an iframe there is a specific

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.