Speed ​​Speed ​​Site na Asynchronous Javascript

asynchronous

Ọ bụ ezie na m na-eme ọtụtụ mmepe, anaghị m ewere onwe m dịka ezigbo onye nrụpụta. Enwere m ike mmemme ma megharia ihe na ibe ma mee ka ọ rụọ ọrụ. Ezigbo onye nrụpụta ghọtara otu esi emepe koodu ahụ ka e wee tụọ ya, ghara iwere ọtụtụ akụ, buru ngwa ngwa, gbanwee ngwa ngwa ma rụọ ọrụ.

Ebe siri ike nke etinyebere ndị ahịa bụ ka ha abụọ nwee nnọọ web saịtị ma ka na-etinye njikọta na mmekọrịta mmadụ na ibe ya nke nwere ike ịmepụta ịdabere na ngwa ngwa saịtị gị ga-ebu. Otu n'ime ha bụ bọtịnụ ndị na-elekọta mmadụ. Na Martech, anyị nwere bọtịnụ mmekọrịta na ibe ọ bụla na saịtị ahụ. Ya mere,… ma ọ bụrụ na Facebook ego ibu ngwa ngwa otu ụbọchị, ọ na-ebelata anyị na saịtị. Wee tinye Twitter, Pinterest, Buffer, wdg na nke ahụ ma ohere saịtị gị nke ibudata ngwa ngwa belata ka ọ nweghị ihe ọ bụla.

Nke ahụ ka a maara dị ka synchronous loading. Ikwesiri imecha otu ihe tupu ị na-ebu ihe na-esote. Y’oburu n’ichoo ibu ihe n’enweghi ike, inwere ike ibu ihe n’enweghi ntukwasi obi n’ime ibe gi. You nwere ike meziwanye ọsọ ọsọ nke saịtị gị site na itinye ihe asynchronously. Nsogbu bụ na ederede ederede na ụlọ ọrụ ndị a na-enye gị ọ fọrọ nke nta ka ọ bụrụ na ọ kachasị nke kachasị mma iji rụọ ọrụ asynchronous.
asynchronous

Nwere ike ịhụ ihe na-emetụta ọsọ ọsọ peeji gị site n'ịgba ule na Pingdom:
pingdom peeji ibu

Javascript asynchronous na-enye gị ohere ide koodu nke na-agwa ndị ọcha ka ha buru ibu mgbe a kpochapụrụ peeji ahụ kpamkpam. Enweghị ịdabere! Yabụ, peeji gị na-ebu ibu ma ozugbo ọ gwụchara, edemede na - ebido ibu nke ọzọ - na nke a, bọtịnụ mmekọrịta anyị. Ọ bụrụ n’ị bụ onye nrụpụta, ị nwere ike ịgụ nnukwu edemede, Umengwụ Loading Asynchronous Javascript.

Nke a bụ mpempe otu esi eme ya nke ọma site n'aka Emil Stenström:

(ọrụ () {ọrụ async_load () {var s = document.createElement ('akwukwọ'); s.type = 'ederede / javascript'; s.async = eziokwu; s.src = 'http://buttondomain.com /script.js '; var x = document.getElementsByTagName (' akwukwọ ') [0]; x.parentNode.insertBefore (s, x);} ma ọ bụrụ na (window.attachEvent) window.attachEvent (' buru ibu ', async_load); ọzọ window.addEventListener ('ibu', async_load, ụgha);}) ();

Nsonaazụ bụ ma ọ bụrụ na njikọta ndị ọzọ a dị ala ma ọ bụ na-agba nwayọ, ọ dịghị emetụta ọdịnaya ọdịnaya peeji gị ka ọ pụta. Ọ bụrụ na ịlele isi mmalite nke ibe anyị, ị ga-ahụ na m na-etinye akwụkwọ edemede ndị ọzọ niile na-eji usoro a. Usoro mma anyị na saịtị ahụ ọsọ sekọnd - na ọ dịghị ịkpagbu n'oge loading. Anyị agbanwebeghị ihe niile anyị ji eme mpụga Javascript asynchronous, ma anyị ga-eme ya.

Kedu ihe ị chere?

Ebe a na-eji Akismet iji belata spam. Mụta otu esi etinye usoro data gị.