window.location.href无法在IE上运行 [英] window.location.href not working on IE

查看:283
本文介绍了window.location.href无法在IE上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的window.location.href有问题。

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"+'?modoJuego='+modoJuego+"&etapa="+etapa+"&rango="+rango;

它在Firefox和Chrome上完美运行,但在IE10浏览器冻结,我必须重新启动它。有时它会重定向到所需的页面,但参数不会通过。我一直在寻找一个解决方案,例如这个:

It works perfectly on Firefox and Chrome, however in IE10 the browser freezes and I have to restart it. Sometimes it redirect to the desired page, but the parameters do not pass through. I have been looking for a solution, for example this one:

Window.Location在IE中不起作用?

但建议的解决方案对我不起作用。

But the proposed solution do not work for me.

有人知道如何处理这个吗?

Do somebody know how to deal with this?

推荐答案

问题可能是由于变量的值。如果它们包含特殊或无效字符,则需要通过 encodeURIComponent ,然后分配给 window.location.href

The problem is likely due to the value of your variables. If they contain special or invalid characters, those needs to be passed through encodeURIComponent before being assigned to window.location.href.

这篇关于window.location.href无法在IE上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆