移动设备上的 iFrame 重定向和重新加载主页问题 phone
iFrame redirecting & reload homepage issue on mobile phone
我下面的两个代码运行良好。第一个代码在 pc 上运行良好,第二个代码在移动设备上运行 phone。但我想在移动设备上使用第一个代码和第二个代码代理在 30 秒后自动重新加载。
如何在第一个代码上添加第二个移动代理代码?
第一个代码:
<script>
window.setInterval("reloadIFrame();", 30000);
function reloadIFrame() {
document.getElementById("test").src="http://example.com";
}
</script>
第二个代码:
<script>
var isMobile = function() {
return /(iphone|ipod|ipad|android|blackberry|windows
ce|palm|symbian)/i.test(navigator.userAgent);
};
if(isMobile()) {
window.location.href = "https://example.com";
}
</script>
抱歉英文不好。
请帮我解决。谢谢
据我所知,您也在尝试在移动页面中使用相同的延迟功能。在这里你可以试试这个,如果有问题请问:
/* Define the functions */
var reloadIFrame = function() {
document.getElementById("test").src="http://example.com";
};
var isMobile = function() {
return /(iphone|ipod|ipad|android|blackberry|windows ce|palm|symbian)/i.test(navigator.userAgent);
};
/* Begin */
if (isMobile()) {
window.setInterval("reloadIFrame();", 30000);
}
我下面的两个代码运行良好。第一个代码在 pc 上运行良好,第二个代码在移动设备上运行 phone。但我想在移动设备上使用第一个代码和第二个代码代理在 30 秒后自动重新加载。
如何在第一个代码上添加第二个移动代理代码?
第一个代码:
<script>
window.setInterval("reloadIFrame();", 30000);
function reloadIFrame() {
document.getElementById("test").src="http://example.com";
}
</script>
第二个代码:
<script>
var isMobile = function() {
return /(iphone|ipod|ipad|android|blackberry|windows
ce|palm|symbian)/i.test(navigator.userAgent);
};
if(isMobile()) {
window.location.href = "https://example.com";
}
</script>
抱歉英文不好。
请帮我解决。谢谢
据我所知,您也在尝试在移动页面中使用相同的延迟功能。在这里你可以试试这个,如果有问题请问:
/* Define the functions */
var reloadIFrame = function() {
document.getElementById("test").src="http://example.com";
};
var isMobile = function() {
return /(iphone|ipod|ipad|android|blackberry|windows ce|palm|symbian)/i.test(navigator.userAgent);
};
/* Begin */
if (isMobile()) {
window.setInterval("reloadIFrame();", 30000);
}