2016 m. kovo 29 d., antradienis

seo dynamic url - hashbang

Google sees a link to example.com/#!/blog
Google requests example.com/?_escaped_fragment_=/blog

php:
if(isset($_GET['_escaped_fragment_'])) {
    Header( "HTTP/1.1 301 Moved Permanently" );
    header('Location: http://'.$_SERVER['HTTP_HOST'].$_GET['_escaped_fragment_']);
    die();
}

js:
history.pushState('page', null, '/#!/'+v.url+'/');

https://github.com/browserstate/history.js/ - pluginas kuris history state daro su hashbang arba be jo prilausomai ar html4 ar html5 narsykle

hadangi html5 palaiko pushstate, tai vengti hashbang.

FB mygtuku atveju nenaudoti hashbang, vistiek turime patiekti originalu normalu url.
Jeigu dinamiskai keitesei url, galima perkrauti FB skriptus:
FB.XFBML.parse(document.getElementById('myModal'));

Facebook scraper is respecting the google ajax specifications and it will convert the #! to ?_escaped_fragment_= You can check this out for yourself with the facebook debugger:https://developers.facebook.com/tools/debug

Update - google jau palaiko JS, todėl: Instead of the _escaped_fragment_ URLs, we'll generally crawl, render, and index the #! URLs.



2016 m. kovo 20 d., sekmadienis

2016 m. kovo 10 d., ketvirtadienis

WebSockets tutorial

websockets - dvipusis bendravimas serverio su narsykle
http://www.binarytides.com/websockets-php-tutorial/
js biblioteka http://socket.io/   o serverside naudoti node.js


server-sent events - info uzklausimai kas kelias sekundes. Galima is serverio paduoti retry parametra po kiek laiko kita karta uzklausti info.
http://www.w3schools.com/html/html5_serversentevents.asp
Jau susijungus su serveriu, glaima padaryti, kad php skriptas tampa veikiantis be sustojimo su while, ir su obflush ispushina info narsyklei tada kada nori serveris: http://www.howopensource.com/2014/12/introduction-to-server-sent-events/

Long Polling Ajax - kai uzklausa nueina i sevreri, o srveris atsako tik tada, kai turi naujos info. Uzdedamas ilgas timeout. Gavus atsakyma, uzklausa vel kartojama is narsykles i serveri:
http://techoctave.com/c7/posts/60-simple-long-polling-example-with-javascript-and-jquery/

2016 m. kovo 2 d., trečiadienis