我试图弄清楚如何让 Dashcode Web 应用程序来区分 iPhone 浏览器和 iPad 浏览器。一个有效的示例是 Apple iPad 用户指南。 iPad 将显示一个光滑的破折号内置界面。 iPhone 被重定向到网页。
我在 如何强制 DashCode 问题。
我正在编辑redirector.js 文件。下面强制iPad使用由Dashcode构建的Safari布局,而不是Mobile Safari,这正是我想要的。当从 iPhone 浏览时,会返回文件未找到错误。
// redirect to the more appropriate product
if (DCProductURLs["mobileweb"] && DCshowiPhone) {
// Changed case so that the Safari layout is displayed on iPad
// window.location.href = DCProductURLs["mobileweb"];
window.location.href = DCProductURLs["desktop"];
}
感谢您的任何建议。
I am trying to figure out how to get a Dashcode web application to distinguish between an iPhone browser and iPad browser. A working example of this is the Apple iPad User Guide. An iPad will display a slick dashcode built interface. The iPhone gets redirected to a web page.
I found some help in the Howto force DashCode question.
I am editing the redirector.js file. The following forces the iPad to use the Safari layout built by Dashcode instead of Mobile Safari, which is what I want. When it is browsed to from an iPhone, it returns a file not found error.
// redirect to the more appropriate product
if (DCProductURLs["mobileweb"] && DCshowiPhone) {
// Changed case so that the Safari layout is displayed on iPad
// window.location.href = DCProductURLs["mobileweb"];
window.location.href = DCProductURLs["desktop"];
}
Thanks for any suggestions.
发布评论
评论(3)
测试 window.navigator.userAgent。它将包括 iPad 上的 iPad 或 iPod touch 上的 iPod。
Test window.navigator.userAgent. It will include iPad on an iPad or iPod on an iPod touch.
我最终最终使用了一些基于 ScottRockers 博客上的这篇文章。感谢 ughoavgfhw 让我走上了正确的道路。
I ultimately ended up using some code based on this post at ScottRockers blog. Thanks to ughoavgfhw for putting me on the right track.
我修改了我的redirector.js 文件,并且正在做您想要的事情,也许不是最好的方法,但它正在工作,这是我的代码,我希望对您有用:
I modify my redirector.js file and is doing exactly what you want, maybe is not the best way to do that but it is working, here is my code I hope that works for you: