简体   繁体   中英

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. I would like to know how to create permalinks to open pages in those iframes that are not included in the src=() element.

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"

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.

Using the url scheme you used in the page

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

you would author your iframes like so

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

with javascript you could just

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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