Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Script to detect ipad browser in iweb?

I've dug into the iweb package contents (and given myself permission to tamper with them) and I'm now looking for the script used to detect browser version


I'm particularly looking for the detection of an ipad and would like to force it to the full site rather than mobile


I can see the file iWebSite.js which references iphone/mobilesafari. Is this the right script to alter? What needs to be changed to direct an ipad browser to the full 'slideshow' of an album?


Any pointers much appreciated. I'm hoping that despite any announcements iWeb on MMe/iCloud will be around for a while ;-)

iWeb '08, Mac OS X (10.6.7)

Posted on Jun 12, 2011 2:02 PM

Reply
7 replies

Jun 12, 2011 6:19 PM in response to Guy Parry

I can see the file iWebSite.js which references iphone/mobilesafari. Is this the right script to alter?


yes, however there s no variable for ipad so you have to add it

search for: var isiPhone

add var isiPad after that.


then add code to detect ipad user agent.

search for: isiPhone=(ua.indexOf("mobile/")!=-1);


then replace it with:


isiPhone = (ua.indexOf("mobile/") != -1 && ua.indexOf("iphone") != -1 ua.indexOf("ipad") == -1);

isiPad = (ua.indexOf("mobile/") != -1 && ua.indexOf("iphone") == -1 ua.indexOf("ipad") != -1);

Jun 13, 2011 12:08 AM in response to Guy Parry

Paste this in a HTML Snippet :


<script language="JavaScript" type="text/javascript">
<!--

var agent=navigator.userAgent.toLowerCase();

// iPhone and iPod touch are both 'iphone'

var is_iphone = (agent.indexOf('iphone')!=-1);
var is_ipad = (agent.indexOf('ipad')!=-1);

alert("iphone = " + is_iphone + "\nipad = " + is_ipad );

if (is_iphone || is_ipad) {
    top.window.location = "http://www.mydomain.com";
    }

// -->
</script


Found with this search : detect mobile browser


More Made for iPad with iWeb pages here: http://www.wyodor.net/mfi/

Script to detect ipad browser in iweb?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.