[removed].href not working on IE

前端 未结 4 1905
陌清茗
陌清茗 2020-12-10 17:23

I have a problem with window.location.href.

I\'m trying to redirect to a page with the following code:

window.location.href = \"juego.html\"+\'?modo         


        
4条回答
  •  北荒
    北荒 (楼主)
    2020-12-10 18:10

    Use encodeURIComponent() to escape your url:

    window.location.href = encodeURIComponent("juego.html?modoJuego=" + modoJuego + "&etapa=" + etapa + "&rango=" + rango);
    

    Works fine on Firefox 23.0, Chrome 28.0.1500.95 and Internet Explorer 10.

提交回复
热议问题