I need my link to open in a new window, my link is currently
< a href=" http://www.ghostlypets.com/avatars.html " > Whateva <a/>
what do i need to add to make it open in a new window?

Dani AI

Generated

The anchor in 's first post is malformed (nested anchors and misplaced quotes). pointed to the right attribute to use — adding a target tells the browser to open the link separately — but there are a few practical and security points to add.

A clean, modern example that keeps the original nofollow and avoids the window.opener risk looks like this:

<a href="https://www.ghostlypets.com/avatars.html" target="_blank" rel="nofollow noopener noreferrer" title="Opens in a new window">Whateva</a>

Notes and troubleshooting:

  • Do not nest <a> tags; each link must be a single anchor element with its attributes. Malformed markup is the most common reason the link won’t behave as expected.
  • Add rel="noopener noreferrer" when using a new window/tab to prevent the opened page from accessing the original page via window.opener (security and performance). If you also need search-engine behavior, keep nofollow in the same rel list. More on the element and attributes is documented at MDN: a element and the window.opener issue at MDN: Window.opener.
  • Accessibility/UX: indicate that the link opens a new window (visible text or screen-reader-only text, or title/aria-label). Forcing new windows can be disruptive; prefer leaving the choice to users unless there’s a clear reason.

Quick tests: view source or use the inspector to confirm a single, well-formed <a> element; try the link in a browser tab to confirm it opens separately; check the console for HTML parse errors if behavior is unexpected.

Recommended Answers

All 2 Replies

<a href="page.html" target="_blank">

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.