开发者

How to make a iPhone tester in my site to report if sites are mobile adapted

开发者 https://www.devze.com 2023-04-06 19:33 出处:网络
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 fram开发者_开发知识库e

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 fram开发者_开发知识库e 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!)


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:

curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C25 Safari/419.3');

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.


Let me google that for you :

http://shaunmackey.com/articles/mobile/php-auto-bowser-detection/


Try the code from Redrome.com. They show how to load the page properly.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号