• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

html request

#4
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.
 

Perris Calderon

Moderator
Staff member
Political User
#5
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
 

Electronic Punk

willalwaysbewithyou
Staff member
Political User
#6
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 :)
 

jukkish

OSNN One Post Wonder
#8
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.
 
#9
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.
 

Perris Calderon

Moderator
Staff member
Political User
#10
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:
#11
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.
 

Perris Calderon

Moderator
Staff member
Political User
#12
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:

osnnraptor

OSNN One Post Wonder
#13
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 posts

Latest profile posts

Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,961
Messages
673,239
Members
89,017
Latest member
loxioalix