Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบเครือข่าย >> อินเทอร์เน็ต

วิธีเปลี่ยน User Agent ใน Chrome, Firefox และ Edge

User Agent คืออะไร?

เหมือน "บัตรประจำตัว" ของเบราว์เซอร์ บอก OS, Browser, Architecture -> เว็บเซิร์ฟเวอร์ส่งหน้าที่ปรับให้เหมาะสม (Mobile vs Desktop)

เปลี่ยน User Agent = ทดสอบเว็บบนแพลตฟอร์มอื่น หรือซ่อนตัวตนบางส่วน (ไม่ได้ = Incognito/Anonymous)

Edge: กด F12 -> Tab Emulation -> User Agent string list -> เลือก Browser ที่ต้องการ

หน้าจอ Refresh ทันที ทดสอบได้จริง

Chrome: Ctrl+Shift+I -> Network -> 3 จุด -> More tools -> Network Conditions -> Untick "Select automatically" -> เลือก User Agent

ทำงานเฉพาะแท็บนั้นๆ และต้องเปิด DevTools ไว้

Firefox: about:config -> ค้นหา/สร้าง general.useragent.overridepreference (String) -> ใส่ค่า User Agent ที่ต้องการ

ตัวอย่างค่า:
Chrome on Linux: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36...
Edge: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36... Edge/13.10586
IE: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko

Extensions ทางเลือก

  • Chrome: User Agent Switcher (โดย Google เอง ปลอดภัย)
  • Firefox: User Agent Switcher (โดย Linder - Featured extension)

สรุป

เปลี่ยน User Agent ได้ทั้งในตัวเบราว์เซอร์และ Extensions เหมาะสำหรับ Developer ทดสอบ Responsive Design