Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

frikfrak

macrumors regular
Original poster
Sep 17, 2007
101
0
Hope my title gets the point across. I need someone to point me in the right direction. Here's what I'm trying to do:

I've designed a web page, mysite.com, like this:

<body>
Some stuff at the top<br>
<iFrame>ADDRESS_FROM_BROWSER_URL_INSERTED_HERE</iframe>
</body>

I want to be able to enter a URL in the browser like this:

mysite.com/???whatever???=ADDRESS-THATS-INSERTED-AS-IFRAME-TARGET_HERE

...and have the iframe target address placed in appropriate place on the page.

How do I go about doing this?
 
You can use PHP to parse the URL string and get any variables out of there,
PHP:
$url = $_GET['url'];
echo '<iframe src="', $url, '"></iframe>";
JavaScript can do similar things, but takes more effort to pull out the argument, but you could have the URL as a hash in the URL too, page.html#http://...

The method above on its own could be used maliciously by an attacker on your site, so you would probably want to sanitize the URL given. Maybe make a white-list of URLs that you're OK with having displayed.

An alternative, setup a proxy on your site. Look into PHPproxy.
 
This is exactly the sort of hint I needed to get started. Any other help is welcomed. Thanks
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.