Grow your CSS skills. Land your dream job.

How to open a link in new window with a header?

  • # April 2, 2013 at 5:40 pm

    Hello!

    I have some links and I want when I click on them , open up in a new window with a header bar containing some text or images like some template centers which show their templates’ demos and you can change template through a header and it’s always static.

    notice that I want to do this in html.

    thanks in advance!

    Alireza.M

    # April 2, 2013 at 5:51 pm

    If you want to use a template, you’ll have to use some more dynamic language like PHP or ASP.

    If you want to use just HTML, you’ll have to create a separate page for each link, each page containing the header bar and the page you want to show.

    # April 2, 2013 at 6:12 pm

    you mean I can’t style an html header bar and just change the links’ address and all of the links open with that header?

    # April 2, 2013 at 6:17 pm

    How about an iframe? Not sure your header would have access to do DOM stuff in the iframe though.

    # April 2, 2013 at 6:30 pm

    I think it can be done with iframes but don’t know how.

    I want a header with simple text and img tags.

    but everypage which it’s link is in my html should open with this header.

    # April 2, 2013 at 8:03 pm

    > you mean I can’t style an html header bar and just change the links’ address and all of the links open with that header?

    Not with just HTML, no. With PHP it’s very simple though.

    # April 3, 2013 at 5:09 am

    ok dear @Sneff, Can you help me to achieve it?

    # April 3, 2013 at 5:52 pm

    I have found this but because I’m using just html I couldn’t know where to add this :

    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;



    # April 3, 2013 at 10:22 pm

    @AlirezaM From what I understood, you want a header template to appear in a certain set of webpages. Just like @Senff stated, you cannot do this with HTML alone. You will have to use PHP or another language with this sort of template functionality. In PHP though, it’s as simple as placing the header inside an HTML file and then in every link you want that file to appear in (you’ll have to make these separate webpages `.php` files to parse the PHP), you’ll just use the following:
    `include ‘header.html’`
    Just replace `header.html` in the previous line, if your HTML file containing the header is named something else.

    # April 4, 2013 at 3:02 am

    You can do it in HTML using iframes, but they were weird even back in the day, so I wouldn’t use them. You also used to be able to do it in HTML using server side includes (SSI), but I don’t know if that still works these days or not. Either way, they’re older methods and I would just stick with PHP because it’s more widely used these days.

    # April 4, 2013 at 6:50 am

    @srig99 , now I want to do this with PHP but because all of those links which I want to show them with my header aren’t my own pages (I want to link to other webpages) so I can’t put this include ‘header.php’ inside of those pages.

    I want to do this with for example with class which is given to a tag and all the a tags which have this class should open the page with that header even if the link was from another website.

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".