สอบถามวิธีการเขียน 1 page เพื่อรองรับการเข้าใช้งานพร้อมกัน
ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา สอบถามวิธีการเขียน 1 page เพื่อรองรับการเข้าใช้งานพร้อมกัน
สอบถามวิธีการเขียน 1 page เพื่อรองรับการเข้าใช้งานพร้อมกัน
ระหว่างการเขียน 1 หน้าด้วย html ทั้งหมด ซึ่งจะมีรูปภาพด้วยโดยดึงจาก link url กับ การนำ html นั้นไปปรับเป็น json api เเล้วนำมา feed ลงในเพจ วิธีไหนที่จะรองรับการเข้าใช้งานของ user พร้อมๆกัน ได้มากกว่าครับ

คำแนะนำ และการใช้งาน
สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก
- ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
ความคิดเห็นที่
1
ทั้งสองแบบก็สามารถทำให้รองรับการใช้งานจำนวน
มากได้เหมือนกัน แต่ต้องเข้าใจหลักการ ถ้ารองรับการใช้งานพร้อมกันหลายๆ คน
คงต้องไปกังวลเรื่องรูปภาพมากกว่า ดูเรืองการทำ cache การทำ lazyload และดู
เรื่องประสิทธิภาพของ server ที่รองรับ
คงต้องไปกังวลเรื่องรูปภาพมากกว่า ดูเรืองการทำ cache การทำ lazyload และดู
เรื่องประสิทธิภาพของ server ที่รองรับ

ความคิดเห็นที่
2
ตัวอย่าง Code แบบคร่าวๆ ที่ช่วยลดภาระการโหลดรูป ด้วยหลักการ Blob URLs ครับ
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | <!DOCTYPE html> <html> <head> <meta charset= "UTF-8" > <title>Example</title> <style> #image { width: 281px; height: 41px; } </style> </head> <body> <script> async function loadImage() { try { // Get the image element by id let image = document.getElementById( "image" ); // Fetch the image data from a URL // Check if the response is ok if (response.ok) { // Get the blob data from the response let blob = await response.blob(); // Create a blob URL from the blob data let url = URL.createObjectURL(blob); // Assign the blob URL to the src attribute of the image element image.src = url; } else { // Throw an error if the response is not ok throw new Error( "Image not found" ); } } catch (error) { // Log the error to the console console.error(error); } } // Call the loadImage function when the window loads window.onload = loadImage; </script> <img id= "image" src= "" alt= "Image" > </body> </html> |

ขอบคุณทุกการสนับสนุน
![]()