3 Replies - 2792 Views - Last Post: 04 April 2013 - 09:20 AM

#1 AIintern  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 53
  • Joined: 06-June 12

alternative command to open a link in a new tab/window?

Posted 04 April 2013 - 09:00 AM

I am using the window.location.replace() Command right now, and its sending me directly where I want, but I was hoping there was another command that would open up the link in a new window or tab.

Any suggestions?

Thank you all :)
Is This A Good Question/Topic? 0
  • +

Replies To: alternative command to open a link in a new tab/window?

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9260
  • View blog
  • Posts: 34,748
  • Joined: 12-June 08

Re: alternative command to open a link in a new tab/window?

Posted 04 April 2013 - 09:10 AM

This post looks to be missing information, but if you are looking to set the target of the link then just modify your 'a href'.

http://www.w3schools...tt_a_target.asp
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3515
  • View blog
  • Posts: 11,999
  • Joined: 12-December 12

Re: alternative command to open a link in a new tab/window?

Posted 04 April 2013 - 09:18 AM

window.open(url,'_blank');

attempts to open a new window (or tab) but the behaviour is determined by the user's browser settings. Adding a target to an a-link (target="_blank") may behave better, but we still do not have control over how the browser will respond.

https://developer.mo...DOM/window.open
Was This Post Helpful? 0
  • +
  • -

#4 AIintern  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 53
  • Joined: 06-June 12

Re: alternative command to open a link in a new tab/window?

Posted 04 April 2013 - 09:20 AM

Im sorry for missing info on this post. Ill set up an example to show you what I mean

Think of it like this


I have a drop down box, and a button that says "Stats".

The drop down box has a list of Quarterbacks in the NFL, and once you select the Quarterback you want and hit "Stats" it will send you to their Stat page on NFL.com (just an example)

But the problem is once you hit "stats" the new webpage loads on the same webpage as my program, so to search again you have to hit back, then re select another qb, then repeat.

I was hoping that once you hit the "Stats" button, another page would pop up.


I am using if statements to direct the user to the correct page
if(qb=='TomBrady')
    {    
        window.location.assign('www.nfl.com/tombrady')
    }


That is not the exact code, that was just to give you an idea of what I was doing.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1