safari/chrome onsubmit=“location.reload(true)” not working

 ̄綄美尐妖づ 提交于 2019-12-01 17:25:34

Since it was the solution for you:

Using setTimeout sometimes works as a hacky solution by postponing execution for a very short time: http://jsfiddle.net/xzanQ/.

You could try:

window.location.href=window.location.href

onsubmit gets executed before a form is posted. If a page is already being unloaded, the form may not be submitted anymore.

Try something like:

var myForm=document.getElementById('myForm');
myForm.addEventListener('submit',function(event){
  event.preventDefault();
  this.submit();//Submit the form BEFORE reloading
  location.reload(true);      
},false);

I just faced a similar problemnd after debugging for hours I found out that a ; was missing in my onsubmit statement..

Changing:

onsubmit="location.reload(true)"

To:

onsubmit="location.reload(true);"

Fixed my safari on mac problem..

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!