Safari openwindow function behavior on iPad versus iPhone
- by CodeLizard
An identical javascript:openwindow call with a link to Google maps opens in Safari on the iPad but in the Google Maps App on the iPhone.
Why the difference?
<html>
<head>
</head>
<body>
<a title="View an area map for this property"
href="javascript:openwindow
('http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=1+Infinite+Loop,
+Cupertino,+CA%E2%80%8E&sll=37.329389,
-122.029696&sspn=0.015714,0.033023&ie=UTF8&hq=&hnear=1+Infinite+Loop,
+Cupertino,+Santa+Clara, +California+95014&ll=37.331539,
-122.030704&spn=0.007857,0.016512&z=17&ssa=1', 760, 500,'yes', 'yes')">
<font face="arial,helvetica" color="#000000" size="-1">Map It</font>
</a>
</body>
<script>
function openwindow(url,width,height,resizable,scrollbars,posx,posy)
{
if(posx==null)posx=20;
if(posy==null)posy=20;
now=new Date();
var x_offset=0;
var y_offset=0;
try
{
if(window.screen.left != undefined && window.screen.top != undefined)
{
x_offset=window.screen.left;
y_offset=window.screen.top;
}
}catch(e){}
var window_x=posx+x_offset;
var window_y=posy+y_offset;
new_window=window.open(url,now.getTime(),'width='+width+',height='+height+',
resizable='+resizable+',scrollbars='+scrollbars+',top='+window_y+',
left='+window_x+',screenX='+window_x+',screenY='+window_y);
if(!new_window.opener)
new_window.opener=self;
try
{
new_window.focus();
}catch(e){}
}
</script>
</html>