我正在尝试提醒我网站上的移动设备用户在横向模式下使用他们的设备。我弹出了一个警报,但它似乎陷入了无限循环。用户单击确定后,我将如何停止该循环?
这是代码:
window.ondeviceorientation = detectIPadOrientation;
function detectIPadOrientation ()
{
if ( orientation == 0 || orientation == 180 ){
alert ('Please use your iPad in landscape mode');
}
}