doujiao1949 2011-03-02 11:43
浏览 271
已采纳

网址只能通过手机访问

i have web and mobile application. On my web application i have url address www.myweb.com/mobile/update which generate xml for mobile application (java application, xml is used for updating data in this app). Is some way how to made these url accessible only from mobile (java application) and restrict it for others web users? I am using php and apache server. Thanks for you advices and sorry form my english. ;)

  • 写回答

5条回答 默认 最新

  • dongzhao1865 2011-03-02 11:50
    关注

    On you're specific page, you'll have to detect if the browser which is loading the page is a mobile one or not -- and, if it is, redirect the user to another page.

    In order to detect if a user is using a mobile browser, you can use solutions such as WURFL.


    But note that it's the browser itself that's indicating if it's a mobile one... so that information is not to be trusted.

    Several mobile browsers allow the user to change the User-Agent that's sent to the server -- quite often, that feature used because the user feels his choice is better than the webmaster's one (I'm the best placed to judge if I want to see the mobile website, or the non-mobile one !)


    Generally speaking, you should :

    • Detect if a user is using a mobile device
      • If he not is (and is on the mobile website), suggest him to visit the normal website
      • If he is (and is on the normal website), suggest him to visit the mobile website.

    But :

    • Never trust the User-Agent.
    • And let each user the choice.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C