It is currently Sat May 19, 2012 9:37 pm

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: How to Make button and Image Links open in a new window HTML
Unread postPosted: Sun Nov 23, 2008 11:55 am 
Offline
Site Admin
User avatar

Joined: Mon Jun 09, 2008 10:09 am
Posts: 499
Location: East Coast USA
When you're linking to a page on another website, it's good to have it open in a new window so you don't lose visitors to that site. Learn how to control that with a little HTML code.

1. Create an external link to a website
2. Go to the HTML of the page --
3. Find the link that you created. If the link I created was for the phrase "AdminXL" linking to the AdminXL.com website

<a href="http://www.adminxl.com">AdminXL webmaster Forum</a>

4. Add the following little tid-bit of code that appears in bold to that line of code..
<a target="_blank" href="http://www.adminxl.com">AdminXL Webmaster Forum</a>

dont forget the " after _blank.. or it wont work.. :-D


Top
 Profile  
 
 Post subject: Re: How to Make button and Image Links open in a new window HTML
Unread postPosted: Tue Dec 02, 2008 8:10 am 
Offline
Apprentice

Joined: Tue Dec 02, 2008 7:57 am
Posts: 4
OR

You can try this out, it took quite long to cusomise how i wanted but here you go..

Code:
<script type="text/javascript">
function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=anchors.length-1; i>=0; i--) {
var anchor = anchors[i];
if (anchor.href && !(anchor.href.substr(0,9) == "http://fo"))
anchor.target = "_blank";
anchor.rel = "nofollow";
}
}
window.onload = externalLinks;
</script>


If your website is haha.com then replace http://fo with http://ha to prevent local links opening in a new window.

EnjoY!


Top
 Profile  
 
 Post subject: Re: How to Make button and Image Links open in a new window HTML
Unread postPosted: Wed Dec 03, 2008 12:50 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 09, 2008 10:09 am
Posts: 499
Location: East Coast USA
thank you for sharing that little piece of code umarsa :-D

havent tested it out yet.
but I will :-D


Top
 Profile  
 
 Post subject: Re: How to Make button and Image Links open in a new window HTML
Unread postPosted: Tue Dec 16, 2008 5:32 pm 
Offline
AdminXL Mod
User avatar

Joined: Fri Jul 04, 2008 8:18 pm
Posts: 81
Thank you this is really helpful, i have always used a javascript code. This is so much easier!

_________________
Cyber Wrld - Online Today!


Top
 Profile  
 
 Post subject: Re: How to Make button and Image Links open in a new window HTML
Unread postPosted: Fri Jan 30, 2009 4:29 pm 
Offline
Apprentice XL

Joined: Sat Dec 27, 2008 7:01 pm
Posts: 33
The Javascript looks nice. I knew this already though... :lol:


Top
 Profile  
 
 Post subject: Re: How to Make button and Image Links open in a new window
Unread postPosted: Thu Jun 16, 2011 4:15 am 
Offline
Apprentice

Joined: Wed Jun 15, 2011 4:23 am
Posts: 15
You're linking to a page on another website, it's beneficial to have it open in a new window so you don't lose visitors to that site. Learn how to control that with a little HTML code.

_________________
online casino | laser eye surgery Belfast | Online Casino Slots


Top
 Profile  
 
 Post subject: Re: How to Make button and Image Links open in a new window
Unread postPosted: Tue Aug 09, 2011 2:09 am 
Offline
Apprentice

Joined: Mon Aug 08, 2011 11:28 pm
Posts: 13
It's good to have it open in a newly window so you don't lose visitors to that website. Learn how to control that with a little HTML code. You're linking to a page on some other web site.

_________________
fulvic acid | fulvic | fulvic ionic minerals


Top
 Profile  
 
 Post subject: Re: How to Make button and Image Links open in a new window
Unread postPosted: Mon Aug 29, 2011 2:38 am 
Offline
Apprentice

Joined: Fri Aug 26, 2011 6:06 am
Posts: 14
They are linked to a page on another website, it's good to have it open in a new window so they don't lose visitors to that site. Learn how to control that with a little HTML code.

_________________
superfoods | cloud hosting | Lift Laser & Body


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
Powered by phpBB Open Source Forum Bulletin Board Software © 2009 phpBB Group
Marketing Advertising SEO Forum   Web Design Forum   Webmaster Market   Website Management Forum  

AdminXL Search Engine Optimized phpbb