Thursday, May 28, 2015

Facebook SDK has js error "Error: element not specified"

It might be Facebook SDK bug on Chrome, because same code works well on Firefox. From stackoverflow, others suggest to try display: popup instead of default 'iframe' value for feed dialog. 

http://stackoverflow.com/questions/15438961/fb-ui-returns-error-element-not-specified

The pseudo code looks like below

FB.ui({
    method : 'feed',    
    //display: 'popup',
    link : {link},
    caption : {caption},
    description : {description},
}, function(response) {
        if (response && response.post_id) {
        } else {
        }
    }
}); 

Friday, May 22, 2015

Chrome extension native messaging

https://developer.chrome.com/extensions/nativeMessaging

Recently we built an extension for messaging between web page and native host, and the architecture is as below diagram. Simply put, extension is a bridge which handles two ports to connect web page and native host.


Thursday, May 14, 2015

CSS pseudo-class

A pseudo-class is used to define a special state of an element.

The :lang pseudo-class allows you to define special rules for different languages.
The :first-child pseudo-class matches a specified element that is the first child of another element.   

CSS Pseudo Elements like (::after, ::before, ::first-letter, ::first-line etc)
CSS Pseudo Classes like (:active, :enabled, :required, :valid, :focus etc)

:active       Adds a style to an element that is activated
:focus        Adds a style to an element that has keyboard input focus
:hover        Adds a style to an element when you mouse over it
:lang         Adds a style to an element with a specific lang attribute
:link         Adds a style to an unvisited link
:visited      Adds a style to a visited link

a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective!!
a:active MUST come after a:hover in the CSS definition in order to be effective!!
Pseudo-class names are not case-sensitive.