Any way to gracefully enforce a timeout limit when loading a slow external file via javascript?

前端 未结 4 760
余生分开走
余生分开走 2020-12-17 18:15

I\'m using javascript to include some content served up from a php file on another server. However, this other service can sometimes get flaky and either take a long time t

4条回答
  •  隐瞒了意图╮
    2020-12-17 18:39

    The only way I can think of doing this is to create a proxy on another (PHP-enabled) server which will fetch the data for you, but will stop when a certain timeout limit has been reached (and it can just return an empty result).

提交回复
热议问题