页面加载期间执行的Javascript行数 [英] Number of Javascript lines executed during page load

查看:81
本文介绍了页面加载期间执行的Javascript行数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用例,我需要在我的网页加载时获得执行的Javascript行总数。

I have an use case where I need to get the total number of Javascript lines executed when my web page is loading.

我面临的问题是当一定数量的JS执行超过时,浏览器会发出警报(如果是IE,则认为是500万)并且页面被挂起。

The problem I am facing is that the browser throws an alert when a certain number of JS execution exceed ( 5 million I think in case of IE ) and the page gets hanged.

我使用了IE中可用的分析器开发人员工具栏,但它给了我调用的JS函数的总数,但没有给出执行行的总数/数量。

I used the profiler available in IE Developers tool bar,but it gives me the total number of JS functions called but not the total number/count of lines executed.

感谢任何帮助。

谢谢

推荐答案

将它拆分成更小的块并在超时后调用 - 解决IE问题。例如。

Just split it into smaller chunks and call after a timeout - that gets around the IE issue. e.g.

somethingBig();
somethingElseBig();

改为写:

somethingBig();
setTimeout(somethingElseBig);

这篇关于页面加载期间执行的Javascript行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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