html request

Code:
<a href="http://www.osnn.net" target="_blank">OSNN</a>
Naturally there will be code needed to check if an option is set as to whether it should put the target attribute there.

In php you could do something like

Code:
<?php
    if ($new_window == true)
    {
        echo "<a href=\"http://www.osnn.net\" target=\"_blank\">OSNN</a>";
     }
     else
     {
        echo "<a href=\"http://www.osnn.net\">OSNN</a>";
     }
?>
May need to replace \" with ' been a few months since I last did PHP coding.

May also just set a variable called $target_attribute to contain target="_blank" if $new_window is set and just echo it in the tag - if its not set nothing shows, if it is you get the target attribute set.
 
Code:
<a href="http://www.osnn.net" target="_blank">OSNN</a>
Naturally there will be code needed to check if an option is set as to whether it should put the target attribute there.

In php you could do something like

Code:
<?php
    if ($new_window == true)
    {
        echo "<a href=\"http://www.osnn.net\" target=\"_blank\">OSNN</a>";
     }
     else
     {
        echo "<a href=\"http://www.osnn.net\">OSNN</a>";
     }
?>
May need to replace \" with ' been a few months since I last did PHP coding.

May also just set a variable called $target_attribute to contain target="_blank" if $new_window is set and just echo it in the tag - if its not set nothing shows, if it is you get the target attribute set.
thanx, will pass it on, I doubt they know enough to make it work but they'll have something to research
 
I used to use these on the frontpage, but speedy said something I am always reminded of when looking over these things - if folks wanted to open pages in a new window they would do it themselves :)
 
I used to use these on the frontpage, but speedy said something I am always reminded of when looking over these things - if folks wanted to open pages in a new window they would do it themselves :)

I think good rule is to open external links to new windows and internal links to same window.


I'm not sure if check box is done with php, I would suspect javascript and possibly AJAX, because it doesn't seem to reload page after checking or unchecking the box.
 
I think in a world of tabbed browsers and being able to middle click "open link in new tab" no link should ever open in a new window. Some popups have their place but thats rare.

Also if your using the target attribute remember to set your HTML Doctype to HTML4 and not XHTML as target isn't valid in XHTML. I can't remember whats happened to it in HTML5.
 
I think in a world of tabbed browsers and being able to middle click "open link in new tab" no link should ever open in a new window. Some popups have their place but thats rare

we all have our preferances geffy, that's why this feature is an opt in rather then default

I personally would much rather a new window then a new tab when I'm on a page that I don't want to navigate away from

while I do use tab browsing at times, to me it is redundant, if you open a new window there is a tab for that window in your task bar and I just don't get the whole tabbed browser fetish

amyway, the feature on this site is opt in and that satisfies everyone, those like yourself who believe you should not "break the back button" and those like me who think you should not be mavigating from a page you haven't finnished

by the way, what is the code to add to links if you want a tab to open in the backround instead of the forground
 
Last edited:
well for people like me tabbed browsing means my task bar buttons dont get shrunk down to application icons with all the windows I would have open.

Browser configuration will change link behaviour to new windows or tabs.
 
well for people like me tabbed browsing means my task bar buttons dont get shrunk down to application icons with all the windows I would have open.
true enough but then you take up real estate below the title bar and I canot stand that

6 or half a dozen, it's preference and that's all, that's why it's such a good idea to let the user decide

Browser configuration will change link behavior to new windows or tabs
I like the way my browser opens links on most sites now and don't want a different configuration, I don't want every link opening in a new window, links off site I like to open in a new window, windows on site I want to open in the same window

just the way this board functions I might add

that's the beauty of the feature, the user decides how they want the page to address links not the person coding the site...brilliant concept
 
Last edited:
this particular site uses javascript (php is not a good option since after you check the checkbox you need to reload the page)
Code:
<script type="text/javascript">
<!--
// thanks to randomwalks.com for this code

function targetLinks(boNew)
{

if (boNew) where = "_blank";
else where = "_self";
for (var i=0; i <=(document.links.length-1); i++)
{

if (document.links[i].href.indexOf("javascript") == -1 ){
document.links[i].target = where;
}
}


} 


//-->
</script>
 
Last edited by a moderator:

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back