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 8244883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:00:22+00:00 2026-06-07T22:00:22+00:00

I want to trigger a Facebook like button as soon as the page loads.

  • 0

I want to trigger a Facebook like button as soon as the page loads.

This is the script required to use a Facebook like button:

<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({
    status : true, // check login status
    cookie : true, // enable cookies to allow the server to access the session
    xfbml  : true  // parse XFBML
  });
</script>

The Facebook like button:

<fb:like href="http://ecommercedeveloper.com" layout="standard" show_faces="true" width="400" action="like" font="segoe ui" colorscheme="light" id="facebook" />

My script, at the bottom of the page:

<script>
  (function($){
    $('fb:like').trigger('click');
  })(jQuery);
</script>

Unfortunately, when the script runs the like button doesn’t seem to be pressed. Is there any way to trigger the like button non-manually?

  • 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-07T22:00:26+00:00Added an answer on June 7, 2026 at 10:00 pm

    You can’t. Clicking on the <fb:like> element has no effect because it’s just a container. The actual clickable “like” button is loaded in an <iframe> inside of it. Because this iframe is loaded from facebook.com, the same origin policy prevents you from accessing its contents (including the link you want) unless you are also on facebook.com.

    If this security restriction did not exist, you would be able to use the following jQuery:

    $(".fb_ltr").contents().find(".connect_widget_like_button").click()
    

    If this were possible it would represent a massive flaw in the web’s security model. If you find some way to do it, you would find it more profitable to sell the exploit to some criminal organization than to use it generating fraudulent “likes”.

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

Sidebar

Related Questions

I want to trigger on click of a button this: <asp:Button runat=server ID=submit Text=Submit
I have a facebook connect button on this site here is the code <fb:login-button
Want to trigger itemClicked event for a QTreeWidget Item using the following code. connect(aTreeWidget,SIGNAL(itemClicked(QTreeWidgetItem*,int)),this,SLOT(CallM(QTreeWidgetItem*
I want to trigger an event with a button that changes the visibility of
If I want to trigger an error in my interpreter I call this function:
I want to trigger a specific input button in a form from another forms
Desired Behavior: After using the Like button on top of my fan page, I
I want to trigger one event on page load complete using javascript/jquery. Is there
I want to trigger the browser's back functionality through a hyperlink in my page
I have the typical splash screen with a Connect with Facebook login button. When

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.