1

I have an AngularJS app which I successfully got to segregate controllers for the hyperlinks to open windows and the target of the hyperlinks was successfully set as a new window.

My problem is, how do I only allocate one and only one window to open all new links, thereby preventing additional new windows from opening.

What I am suspecting is that I need window.location.href used in some way to modify the url location..

How can I achieve this?

Vahe
  • 1,699
  • 3
  • 25
  • 76

2 Answers2

3

You set the target to any keywords other than _blank, _self, _parent, or _top. Then use that same name for any other links you want to target to this window and you're set.

Reference: http://www.w3schools.com/tags/att_link_target.asp

Suthan Bala
  • 3,209
  • 5
  • 34
  • 59
1

You cannot

Use target attribute of the a element to open each time a new tab.

From w3schools:

|   Value   |  Description                                            |
---------------------------------------------------------------------
| _blank    | Opens the linked document in a new window or tab        |
| _self     | Opens the linked document in the same frame (default)   |
| _parent   | Opens the linked document in the parent frame           |
| _top      | Opens the linked document in the full body of the window|
| framename |   Opens the linked document in a named frame            |

Example: https://jsfiddle.net/e5arnb61/

<a href="https://www.google.co.il/#q=search1" target="_blank">This alway open new tab</a>
<br><br>
<a href="https://www.google.co.il/#q=search2" target="_blank">This alway open new tab</a>
David Antoon
  • 815
  • 6
  • 18