link creating new page while view page remains active

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
don_omar
Forum Newbie
Posts: 4
Joined: Wed Feb 27, 2008 2:27 am

link creating new page while view page remains active

Post by don_omar »

Hi I wanted to find out how I can create code for a link where it opens the page in a new tab or window while the page of which i clicked upon remains active. Any help is greatly appreciated.
User avatar
EverLearning
Forum Contributor
Posts: 282
Joined: Sat Feb 23, 2008 3:49 am
Location: Niš, Serbia

Re: link creating new page while view page remains active

Post by EverLearning »

in <a> tag you need to set "target" attribute to value "_blank", like this

Code: Select all

<a href="http://some.link.com" target="_blank">Some.Link.Com</a>
Is that what you meant?
Last edited by EverLearning on Wed Feb 27, 2008 2:58 am, edited 1 time in total.
don_omar
Forum Newbie
Posts: 4
Joined: Wed Feb 27, 2008 2:27 am

Re: link creating new page while view page remains active

Post by don_omar »

hi everlearning, thanks for your reply, i got one problem though. i want the page which i was viewing to remain open or active while the page which opens on clicking on the <a> tag to load in the tab in an inactive status (in other words to load while the page i am viewing to remain open. if that is possible
User avatar
EverLearning
Forum Contributor
Posts: 282
Joined: Sat Feb 23, 2008 3:49 am
Location: Niš, Serbia

Re: link creating new page while view page remains active

Post by EverLearning »

It is possible, but you'll need to use some javascript to do that, and to make sure that the script works correctly for several browsers. Most of the browser already have the ability to open links in background tabs or windows, if user wants to. What do you need that for, anyway?
don_omar
Forum Newbie
Posts: 4
Joined: Wed Feb 27, 2008 2:27 am

Re: link creating new page while view page remains active

Post by don_omar »

thats exactly what I Want. I want the users to open links without leaving my website. so how do I do it?
User avatar
EverLearning
Forum Contributor
Posts: 282
Joined: Sat Feb 23, 2008 3:49 am
Location: Niš, Serbia

Re: link creating new page while view page remains active

Post by EverLearning »

Take a look at this link:
http://snippets.dzone.com/posts/show/2915
its a code snippet for what you want, bu also read this:
http://www.thescripts.com/forum/thread586528.html
where someone else wanted something similar, but had problems with browser security settings.
don_omar
Forum Newbie
Posts: 4
Joined: Wed Feb 27, 2008 2:27 am

Re: link creating new page while view page remains active

Post by don_omar »

Thanks a lot lemme take a look at the snippets.
User avatar
Inkyskin
Forum Contributor
Posts: 282
Joined: Mon Nov 19, 2007 10:15 am
Location: UK

Re: link creating new page while view page remains active

Post by Inkyskin »

This isnt a browsers favourite way of opening windows, it's the same way a lot of old pop-under ad's used to work. Be sure your visitors know that you have opened this window or they may close it thinking its a spam pop-under.
Post Reply