สอบถามวิธีการเขียน 1 page เพื่อรองรับการเข้าใช้งานพร้อมกัน

ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา สอบถามวิธีการเขียน 1 page เพื่อรองรับการเข้าใช้งานพร้อมกัน

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


Antinew007 61.91.168.xxx 23-11-2022 09:47:51

คำแนะนำ และการใช้งาน

สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก


  • ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
  • เปลี่ยน


    ( หรือ เข้าใช้งานผ่าน Social Login )

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


ninenik 27.55.84.xxx 24-11-2022
 ความคิดเห็นที่ 2
ตัวอย่าง Code แบบคร่าวๆ ที่ช่วยลดภาระการโหลดรูป ด้วยหลักการ Blob URLs ครับ

<!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
    let response = await fetch("https://i.postimg.cc/3JNbHKmM/thai-ocr-one-line-test.png");
    // 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>


Sumate Mephokkij 110.77.192.xxx 13-04-2023 21:38






เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ