Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dashcode Distinguish Between iPad and iPhone Browser

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.

like image 546
DenVog Avatar asked Dec 02 '25 05:12

DenVog


1 Answers

Test window.navigator.userAgent. It will include iPad on an iPad or iPod on an iPod touch.

var oniPad = /iPad/.test(window.navigator.userAgent);
like image 194
ughoavgfhw Avatar answered Dec 03 '25 20:12

ughoavgfhw



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!