duan2477 2012-11-17 09:51
浏览 21
已采纳

以编程方式检查网站是否有移动版本。 (Python的/ PHP)

Lets say i have a incoming website request with a url of desktop version of website. I'd like to detect if this website has a mobile version.

According to this answer Fetch website mobile version? most of what i have to do is to set User Agent to some mobile phone and server will serve the mobile version.

I think i could also check m.domain.com and mobile.domain.com.

But here's question:
How would i know if server responded with mobile version?
Are there other ways of getting mobile version?

  • 写回答

1条回答 默认 最新

  • dongleman4760 2012-11-17 09:56
    关注

    I don't believe there is a one size fits all answer to your question. You could use curl to hit the domain with a couple different user agents and see if different content is returned for mobile vs desktop, or see if you are redirected for either.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 CMFCPropertyPage
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题
  • ¥15 谁会P4语言啊,我想请教一下
  • ¥15 这个怎么改成直流激励源给加热电阻提供5a电流呀