强制 iframe 页面作为父页面重新加载的最佳 SEO 方法
<html>
<iframe src="iWantToBeTheParent.html" />
</html>
我认为这是一个 JavaScript 任务,使用 htaccess 处理重定向会很好,因为我的代码将在 iframe 内,我正在寻找一种从 iframe 源内部启动的方法,该方法将使 iframe url 作为父级加载。
我只能访问 iframe 源页面的 html。
是否也可以发送 301 HTTP 重定向?
编辑:如果需要,我可以使用 php 将 iframe 页面的 url 作为 JavaScript 变量打印出来。
<html>
<iframe src="iWantToBeTheParent.html" />
</html>
I think this is a JavaScript task, it would be nice to handle the redirection with htaccess though since my code will inside an iframe I'm looking for a method that initiates from inside the iframe source which would make the iframe url load as the parent.
I only have access to the iframe source page's html.
Would it be possible to send a 301 HTTP redirect as well?
EDIT: I could use php to print out the url of the iframe page as a JavaScript variable if needed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试一些 javascript:
由以下人员提供:
http://usablelayout.com/articles/automatically-break-out-iframe
这会将顶级位置(主页)设置为 javascript 所在页面的位置(iframe 内)。
You could try some javascript:
Courtesy of:
http://usablelayout.com/articles/automatically-break-out-iframe
This will set the top level location (the main page) to the location of the page where the javascript is located (inside the iframe).