简体   繁体   English

使用URL或php在iframe中加载页面

[英]Load a page in an iframe using URL or php

I hope this isn't posted anywhere because it's too obvious. 我希望这不会发布在任何地方,因为它太明显了。

On my website ( Robo Co. ) I use two iframe elements with the names iframe_r and iframe_l. 在我的网站( Robo Co. )上,我使用名称为iframe_r和iframe_l的两个iframe元素。 I would like to know how to create permalinks to open pages in those iframes that are not included in the src=() element. 我想知道如何创建永久链接来打开那些未包含在src =()元素中的iframe。

What I would imagine the link would be something close to: roboserver.zapto.org/main.php&iframe_r="page_to_load"&iframe_l="page_to_load" 我想象的链接将是接近的:roboserver.zapto.org/main.php&iframe_r="page_to_load"&iframe_l="page_to_load“

The URL would then forward the values iframe_r="page1" and iframe_l="page2" into the imbedded php which would then load page1 into iframe_r and page2 into iframe_l. 然后,URL会将值iframe_r =“page1”iframe_l =“page2”转发到嵌入式php中,然后将page1加载到iframe_r中,将page2加载到iframe_l中。

Using the url scheme you used in the page 使用您在页面中使用的url方案

roboserver.zapto.org/main.php&iframe_r=/left/page.php&iframe_l=/right/page.php

you would author your iframes like so 你会像这样编写你的iframe

<iframe id="frameLeft" src="<?= $_GET["iframe_l"] ?>"/>
<iframe id="frameRight" src="<?= $_GET["iframe_r"] ?>"/>

with javascript you could just 用javascript你可以

document.getElementById("frameLeft").src = "new url";
document.getElementById("frameRight").src = "new url";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM