Open link in new window with branded header

ConnieM's picture

They have: 1 posts

Joined: Jul 2007

I may not be calling this the right thing, but I have a client who wants external links from their site to not only open in a new window, but the window to include a small header with their logo and a link to go back to their site. In other words they think people will forget where they were coming from [no debate needed on this Wink ]

About.com used to do this and I've seen other sites do it as well, but naturally I cannot remember where and haven't come across any lately. I've searched for hours and cannot find out how to do this.

Any help would be appreciated. Thanks!

Connie

Connie McVicker
Signature Worx LLC
Because going solo was the plan. Doing it ALL was not.

They have: 27 posts

Joined: Mar 2007

Hi Connie,

It sounds like you are looking to use frames.

I think this page is an example of what you are looking to do:

http://shops.oscommerce.com/directory/goto,25649

Smiling

He has: 698 posts

Joined: Jul 2005

It seems your question was never actually answered. Here are a couple of solutions to your issue.

The first uses frames, which aren't exactly urged anymore because there are other ways to produce the same effect, but for what you are trying to do, I don't see much wrong with them.

First you need to create the file which will contain your header, and save it probably as 'header.htm'. Then create the actual page which will hold your header and the website together, with the following code (assuming the 'header.htm' file is in the same directory as this file:

<html>
<!-- Do not include <body> tags in a page that uses regular frames. -->
<frameset rows="50,*">
  <frame src="header.htm" scrolling="no" noresize="noresize" />
  <frame src="http://www.webmaster-forums.net" />
</frameset>
</html>
'

If you wanted to achieve something like this where the user can actually input a web address to be shown under your header (or some other method where you have the ability to show a variety of different sites, though not at once, on one page), you can use PHP and set the SRC as a variable which will be retrieved either through the POST or GET method in PHP, assuming you have that installed on the server, like this:

<?php
$url
= $_GET['framed'];
<
html>
<
frameset rows="50,*">
  <
frame src="header.htm" scrolling="no" noresize="noresize" />
  <
frame src="<?php echo $url; ?>
" />
</frameset>
</html>
'

Therefore, if someone entered the following URL:

http://www.example.com/frames.php?framed=http://www.webmaster-forums.net

It would have the same effect as the original code I posted.

The next method is to embed each as objects using none other than the tag. The main problem with this is that you would have to set a width and height for each object, and it is hard to specify appropriate heighths to fill the page, and percentages wouldn't work correctly in all size resolutions and browsers.

Anywho, if it might work for you, here is the appropriate code, and as you can see, the main advantage is that it takes only one file, unlike the frames method.

<?php
$url
= $_GET['framed'];
?>

<html>
<body>
<object type="text/html" data="header.htm" height="10%" width="100%">
  <param name="header" value="header.htm">
</object>
<object type="text/html" data="<?php echo $url; ?>" height="90%" width="100%">
  <param name="frameData" value="<?php echo $url; ?>">
</object>
</body>
</html>
'

Another problem is that you must specify MIME types for the files which are to be embedded, and some pages may be HTML files, some may be PHP files, etc, so a whole slew of if...else situations may be necessary to display the page correctly, and that's really just a big mess.

For your situation, I would probably suggest the frames method because it works the easiest for this need. Good luck with your website, and feel free to contact me if you have any more questions. I would be more than happy to help. Wink

Kurtis

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.