如何在我的网站中创建 iPhone 测试器来报告网站是否适合移动设备
我想在我的网站上创建一个部分,用户可以测试他们的网站是否适合移动设备。 有什么办法可以做到这一点吗?我在网上看到很多网站,但我不喜欢将其框架化,我想制作自己的网站。
嗯...麻烦的是那个链接,向我展示了如何移动我的网站,但我想要制作的是我的 joomla 的 php/html 部分,用户可以在其中输入他们的网站,并显示是否已适应。
像这样的东西: www.iphonetester.com
但是,该网站不使用用户代理,所以,如果您输入 http://www.kalyma.com.ar 显示桌面版本,而不是显示 <一个href="http://m.kalyma.com.ar" rel="nofollow noreferrer">http://m.kalyma.com.ar 这是移动版本。 (这是因为我有一个基于用户代理重定向网站的插件!)
I would like to make a section on my site where users can test if their websites are mobile adapted.
Is any way to do that? I see a lot of sites in the net but I don't like to frame it, I'd like make my own.
Mmmm... the trouble is that link, shows me how can mobilize my site, but what I want to make, is a php/html section of my joomla, where users can input their webs, and shows if are adapted.
Something like this: www.iphonetester.com
But, that site, doesn't use the user agent, so, if you put http://www.kalyma.com.ar shows desktop version, instead of showing http://m.kalyma.com.ar which is the mobile version. (this is because I have a plugin which redirects the site based on user agent!)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的...我能想到的唯一方法(这是未经测试的...)
您需要卷曲某人试图访问的页面内容并设置用户代理:
然后您可以将 html 输出到 div 中在您的页面上使用 jquery 的
load()
函数或类似函数。不过,您必须研究如何正确执行此操作,因为您要下载到网络服务器上的任何非绝对链接都必须正确设置基本网址,以便图像和其他内容正常工作。
这是我认为你能做到的唯一方法。
Right... the only way I can think of (and this is untested...)
You need to curl the content of the page that someone's trying to access and set the useragent as such:
Then you can output the html into a div on your page using jquery's
load()
function or similar.You'll have to look into how to properly do it though, because you're downloading onto your web server any non-absolute links will have to have the base url set properly so images and other things work properly.
That's the only way I can think you can do it.
让我帮你用谷歌搜索一下:
http://shaunmackey.com/articles/mobile /php-auto-bowser-检测/
Let me google that for you :
http://shaunmackey.com/articles/mobile/php-auto-bowser-detection/
尝试使用 Redrome.com 中的代码。它们展示了如何正确加载页面。
Try the code from Redrome.com. They show how to load the page properly.