English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

What code do I use to open another web page from the web page the user is currently has open.

2006-07-26 16:27:48 · 4 answers · asked by rfulky 1 in Computers & Internet Programming & Design

4 answers

Don't know coding but seems do me you would create a link. Most software usually has a command to highlight the area and create link.

2006-07-26 16:32:13 · answer #1 · answered by longhats 5 · 0 0

Do you want to output a dynamic link on your site?

">Link



$myvariabletitle" ?>

Are you wanting to forward the user to a different page? (Must be sent before any output is printed.)

header( "Location: http://yahoo.com" );
exit;
?>

or (can be executed after output has already been sent to the browser, but requires javascript or a click)

print '';
print '';
?>

Do you want to read in another web page and output it on your own? (Requires allow_url_fopen to be enabled in the configuration.) Be careful about doing this sort of thing, because if a hundred people hit your page, your server makes one hundred sudden requests to download. If this is the route you're after, look into cacheing/saving the result for a period of time or get fancy and ask the web server if the page has been updated.

$url = "http://www.yahoo.com";
$f = fopen( $url, "r" );
if( !$f ) die( "Could not open $url for reading" );
while( !feof( $f ) ) {
$data = fread( $f, 1024 );

// Print it out
print $data;

// Or store it in a variable
$text .= $data;
}
fclose( $f );
?>

Hope that helps.

2006-07-27 20:32:04 · answer #2 · answered by Hulett H 2 · 0 0

Straight HTML Text would create the link.

If you want to display the page within the page take a look at