【发布时间】:2021-11-21 11:50:57
【问题描述】:
我需要在我正在构建的网页的 iFrame 中加载网站的移动版本, 网址是这个
https://m.calcionapoli24.it/diretta/spalletti-napoli-spartak-mosca-conferenza-n495703.html
但是会自动重定向到桌面版本的 URL
https://www.calcionapoli24.it/diretta/spalletti-napoli-spartak-mosca-conferenza-n495703.html
如何避免重定向?如何强制 IFrame 加载移动版本?
更改用户代理? PHP 卷曲? Javascript AJAX?
代码很基础
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
iframe {
width: 750px;
max-width: 750px;
height: 1334px;
margin: 0 auto;
border-style: none;
border-color: inherit;
border-width: 0px;
display: block;
}
</style>
</head>
<body>
<div>
<iframe src="https://m.calcionapoli24.it/diretta/spalletti-napoli-spartak-mosca-conferenza-n495703.html"></iframe>
</div>
</body>
</html>
【问题讨论】:
标签: javascript php html iframe user-agent