Quiero abrir el elemento en una nueva página cuando el visitante haga clic en btn con la búsqueda de íconos. Quiero redirigir solo el elemento 1 a la nueva página y mostrar más detalles sobre el elemento 1. Vi las mismas soluciones como: window.location='app2.html; o location.replace('https://...') ¿Es una mejor manera de hacerlo?
//app1.html page1 <div class="container"> // item 1 <div class="col-md-3 text-center border border-light m-4"> <img src="..." alt="..."><br> <button class="btn btn-primary"> <i class="bi bi-search" data-id="1"></i> // here is btn with id </button> </div> // item2, ... </div> //app2.html page2 // new pagePuede usar window.location.href = "app2.html"; dentro de una función implícita en js.
function test(){ window.location.href = "http://www.devmedia.com.br"; } <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <script src="test.js"></script> </head> <body> <button onclick="test()">Btn</button> </body> </html>