我需要在一个网页的iFrame内加载一个网站的移动版本,我正在建设,URL是这个
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>
可以在url中添加查询参数ex?from_frame=1
然后从。htaccess文件中捕获此规则,并在。htaccess内部重定向到网站的移动版本