i have put this script to my blog, but it not working perfect because facebook need to confirm like first. ho do solve this?

<div class='widget-content'>
<script src="" type="text/javascript"></script>
    <script src="" type="text/javascript"></script>

    <script type="text/javascript">
    function createCookie(name,value,exp) {
        if (exp != 0) {
            var date = new Date();
            date.setTime(date.getTime()+(24*60*60*1000*exp));
            var expires = "; expires="+date.toGMTString();
        }
        else var expires = "";
        document.cookie = name+"="+value+expires+"; path=/";
    }

    function readCookie(name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for(var i=0;i < ca.length;i++) {
            var c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(1,c.length);
            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
        }
        return null;
    }

    function wpliketounlock()
    {
        jQuery('#branding').css({'z-index':'1'});
        jQuery('#wpliketounlock').css({'height':'auto','width':'450','padding':'0px'});
        jQuery('#wpliketounlock').modal({
            opacity:100,
            escClose:false,
            overlayCss: {backgroundColor:"black"},
            onClose: function (dialog) {
                dialog.data.fadeOut('slow', function () {
                    dialog.container.slideUp('fast', function () {
                        dialog.overlay.fadeOut('slow', function () {
                            if ( 0 == 0 )
                            createCookie("wpliketounlock_liked_4",4,365);
                            jQuery.modal.close();
                        });
                    });
                });
            }
        });
        jQuery('#simplemodal-container').css({'background-color':'white'});
        jQuery('#simplemodal-container').css({'border':'4px solid #cc1f14'});

                    jQuery('#simplemodal-container').css({'border-radius':'10px','-webkit-border-radius':'10px','-moz-border-radius':'10px','behavior': 'url()'});
                jQuery('#likeboxdiv').css({'border-radius':'0px 0px 10px 10px','-webkit-border-radius':'0px 0px 10px 10px','-moz-border-radius':'0px 0px 10px 10px','behavior': 'url()'});
                jQuery('.popupTitle').css({'border-radius':'8px 8px 0px 0px','-webkit-border-radius':'8px 8px 0px 0px','-moz-border-radius':'8px 8px 0px 0px','behavior': 'url()'});
                jQuery('.simplemodal-wrap').css({'border-radius':'10px 10px 10px 10px','-webkit-border-radius':'10px 10px 10px 10px','-moz-border-radius':'10px 10px 10px 10px','behavior': 'url()','overflow':'hidden'});
            }


    var secs
    var timerID = null
    var timerRunning = false
    var delay = 1000

    function InitializeTimer()
    {
        secs = 7000        
        StopTheClock()
        StartTheTimer()
    }

    function StopTheClock()
    {
        if(timerRunning)
            clearTimeout(timerID)
        timerRunning = false
    }

    function StartTheTimer()
    {
        if (secs==0)
        {
            StopTheClock()
            jQuery.modal.close();  
        }
        else
        {
            self.status = secs
            secs = secs - 1
            timerRunning = true
            timerID = self.setTimeout("StartTheTimer()", delay)
            jQuery(".timetoclose").html(secs+"s")
        }
    }                       
    jQuery(function ($) {

                jQuery("div.popupTitle b").html(jQuery("title").html());
            jQuery(".timetoclose").html("7000");
        InitializeTimer();
        setTimeout("wpliketounlock()", 1*1000); 
        FB.Event.subscribe('edge.create',
        function(response) {
            //alert("Like Clicked");
            clicked = true;
            createCookie("wpliketounlock_liked_4",4,365);
            jQuery.modal.close();     
        }
    );
    });
    </script>
    <br />
<div id="wpliketounlock" style="display: none; z-index: 0;">
<div class="popupTitle" style="background-color: #e52a2c; color: white; padding: 5px 5px 5px 5px;">
<span class="CounterAndClose">

                    </span><br />
<div class="timetoclose" style="color: white; font-size: 18px; font-size: small; font-weight: bold; position: absolute; right: 16px; top: -37px;">
<span class="CounterAndClose">7000s
                    </span></div>
<span class="CounterAndClose">
                                                </span>
            <b>auto</b>
        </div>
<div style="background-color: white;">
<img alt="" class="aligncenter size-full wp-image-4" height="234" src="" title="panas" width="400" />        </div>
<div id="likeboxdiv" style="background-color: white; height: 69px; padding: 2px 10px 2px 10px; text-align: center;">
<div id="fb-root">
</div>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
          <fb:like colorscheme="light" href="https://www.facebook.com/blogizam.my" layout="box_count" send="false" show_faces="false" width="65"></fb:like>
        </div>
</div>
<script type="text/javascript">
    jQuery(document).ready( function($) {
            } );
    </script>
    <script src="" type="text/javascript"></script>
</div>

this is DEMO for this script on my blogspot http://mynewsdesigns.blogspot.com/
but, on this blogspot it work without confirm

Dani AI

Generated

Short answer: that “Confirm” step is coming from Facebook itself and you cannot suppress it from your page. Facebook’s like plugin will sometimes open an internal confirm flow (it’s a server-side/SDK decision, not something your modal script can override). (stackoverflow.com)

Why it happens: Facebook uses heuristics to prevent like-jacking and other abuse (rapid clicks, pop‑ups, atypical iframe/modal contexts). When those heuristics trigger, the plugin routes the action through a confirm endpoint (you’ll see mentions of a plugins/error/confirm/like flow in developer reports). That behavior is controlled by Facebook, not by your client JavaScript. (stackoverflow.com)

Practical advice and troubleshooting

  • Stop relying on a forced “like to unlock” modal — Facebook banned incentivizing/like‑gating (developers had to comply by November 5, 2014). If the modal is intended to drive likes, remove the gate and use a different conversion (email signup, share, or clear CTA). (thenextweb.com)
  • Use Facebook’s official Like plugin (inline XFBML or iframe) and the up‑to‑date SDK, load only one SDK instance, and test the button on a plain page (no modal, no extra JS) while logged in and in a clean browser profile. That narrows whether the modal/context is causing the confirm behavior. (crunchify.com)
  • Don’t try to fake or auto‑like via the API — you can’t like a Facebook Page programmatically (use the Like button and FB.Event.subscribe to detect an edge.create event, but it won’t bypass Facebook’s confirm). (stackoverflow.com)

A note on intent: ’s point about “just getting people to hit Like” is relevant—focus on honest UX and alternatives (better copy, clear value, share prompts or email capture) rather than forcing likes; that both avoids Facebook policy issues and usually produces higher‑quality fans.

Recommended Answers

All 3 Replies

Very usefull one thanks for posting

Member Avatar for Member #905211

Are you just trying to get people to hit your facebook like button?

yes, but it will ask confirm first to like. but on this blog don't ask confirm to like.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.