Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to open a new tab in react

//More Secure Solution. For JS only.

const openInNewTab = (url) => {
  const newWindow = window.open(url, '_blank', 'noopener,noreferrer')
  if (newWindow) newWindow.opener = null
}

//Then add to your onClick
onClick={() => openInNewTab('https://stackoverflow.com')}
Comment

open a new tab when clicking on a link react

<td onClick={()=> window.open("someLink", "_blank")}>text</td>
Comment

opening a link in another tab in react

import React from "react";

function App() {
  const handleClick = () => {
    window.open("http://twitter.com/saigowthamr");
  };

  return (
    <div>
      <h2>App</h2>
      <button onClick={handleClick}>Twitter</button>
    </div>
  );
}

export default App;
Comment

open in a new tab react

<td onClick={()=> window.open("someLink", "_blank")}>text</td>
Comment

PREVIOUS NEXT
Code Example
Javascript :: js how to get selectpicker value 
Javascript :: ngmodeloptions standalone 
Javascript :: nestjs create controller with cmd 
Javascript :: javascript get domain name from string 
Javascript :: React + modal: input field auto focus 
Javascript :: Datatable Change page size for pdf 
Javascript :: jquery get element width 
Javascript :: how to convert string to int a array in javascript 
Javascript :: Iterating through an Object 
Javascript :: nodejs put array in file 
Javascript :: vue truncate text 
Javascript :: convert to small case in javascript 
Javascript :: js tab in textarea 
Javascript :: discord.js create unexipable invite 
Javascript :: Add table row in jQuery 
Javascript :: nextjs tailwind 
Javascript :: install jmeter mac 
Javascript :: decet wheter react app in development or production 
Javascript :: electron specify minimum size 
Javascript :: vh not working on phone 
Javascript :: angular 8 how to iterate json object in view 
Javascript :: fast xml parser nodejs 
Javascript :: how to select data attribute in javascript 
Javascript :: Print a number with commas as thousands separators in JavaScript 
Javascript :: conditinally object property js 
Javascript :: angular form set value without fire event 
Javascript :: chrome max local storage size 
Javascript :: How to remove text from a string in javscript 
Javascript :: node js send file from root dir 
Javascript :: react on hover reveal 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =