i created one blog . In that i put other site links . When users clicked that link it opened in the same tab . i need html codings to open in another tab if users click that link . please help

Dani AI

Generated

As already pointed out, the browser provides a way to open a link in a separate browsing context (usually a new tab). Whether it appears as a tab or a separate window is decided by the user agent and the user's settings — web pages cannot reliably force "tab" vs "window." See the browser reference for the anchor element for details: MDN: a element.

Security note: opening external pages in a new context can expose the opener page via window.opener, which hostile pages can abuse (reverse tabnabbing). For external links add rel="noopener noreferrer" so the new page cannot access the opener and the Referer header is not sent. More background and guidance are on MDN and OWASP: MDN: noopener and OWASP: Reverse_Tabnabbing.

Accessibility and UX: opening a new tab is a change of context. Make that clear in the link text (for example append "(opens in new tab)"), or expose it to assistive tech via an appropriate aria-label. Prefer not to open internal site pages in a new tab without reason; users expect links to behave consistently and many rely on browser controls to manage tabs.

If you need to open a page from script, use the window API but remember most browsers will block popups if the call is not initiated by a direct user gesture (click). For the API behavior see MDN: Window.open.

Summary checklist for external links: indicate the change of context to users, add rel="noopener noreferrer" for safety, and avoid forcing new tabs for routine internal navigation. — this keeps the behavior safe and predictable across browsers.

Recommended Answers

All 2 Replies

Simply, target="_blank"?

<a href="your_link.html" target="_blank">Link text</a>

@ Daiva . Thanks a lot friend . . ..

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.