screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/17.0.2/umd/react.production.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/17.0.2/umd/react-dom.production.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script> </head> <body> <div id="app"></div> <script type="text/babel"> // Define the App component const App = () => { const openLink = () => { const newWindow = window.open( "https://fontawesomeicons.com", "_blank", "width=500,height=500" ); if (newWindow) { newWindow.focus(); } }; return ( <div className="container"> <h3>React Js Open link in Window (not Tab)</h3> <button onClick={openLink}>Open Link</button> </div> ); }; ReactDOM.render(<App />, document.getElementById("app")); </script> <style> body { margin: 0; } .container { max-width: 600px; margin: 0 auto; padding: 20px; font-family: Arial, sans-serif; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); position: relative; } /* Styles for the button */ .container button { padding: 10px 20px; font-size: 16px; background-color: #4caf50; color: #fff; border: none; border-radius: 4px; cursor: pointer; transition: background-color 0.3s; } .container button:hover { background-color: #45a049; } </style> </body> </html>