Hice una función que muestra imágenes de tarjetas después de hacer clic en un botón. el problema es que no funciona en Chrome. el editor de Chrome presenta un '/' adicional al final de la ruta.
function renderDeck(deck,ph) { var htmlStr = document.getElementById(ph).innerHTML; for (var i = 0; i < deck.length; i++) { htmlStr += '<div>'; htmlStr += '<img src=' + deck[i].path + '/>'; htmlStr += '</div>'; } document.getElementById(ph).innerHTML = htmlStr; }Un ejemplo de lo que empujo dentro de la cubierta
deck.push({ name: 'red_joker', path: 'cardImages/red_joker.png', val: 15 });¿Cual puede ser el problema?
Fuera de tema: Evitar innerHTML += ... porque
function renderDeck(deck, ph) { // create the markup for the new items const htmlStr = deck.map(item => `<div><img src="${item.path}"></div>`).join("\n"); // parse the `htmlStr` into a DOM Node that you can add to other DOM Nodes. const fragment = document.createRange().createContextualFragment(htmlStr); // append the DocumentFragment to the existing element. document.getElementById(ph).append(fragment); }Y un enlace para aquellos que aún no saben qué es un DocumentFragment .