Java “Browser Freeze” While Loading

这一生的挚爱 提交于 2019-12-24 10:49:03

问题


OK this problem has been bugging me for so long.

Basically I made a signed Java applet that downloads a video from an url. The part of the code which calls the applet is below:

<?php
if(!empty($id)){
echo <<< END
<object codetype="application/x-java-applet" type="application/x-java-applet" code="downloader.class" archive="downloader.jar" height="0" width="0" align="center" cache_archive="downloader.jar" initial_focus="true">
<param name="v" value="$id"/>
<param name="u" value="$id"/>
<param name="ua" value="$agent"/>
It appears you do not have Java installed or it is disabled on your system.<br>
Please download it <a href="http://www.java.com/getjava/" class="link" target="_blank">here</a>.
</object>

<script type="text/javascript">
jQuery(document).ready(function() {
setTimeout("error()",120000);
});
</script>
END;
}
?>

I've properly declared all the variables, $id is the link to the video file so when my website receives a parameter via:

$id = ($_GET['url']);

If the url is not blank then it runs the java applet to download it.

So here is the problem. Whenever the java applet loads, the whole website freezes completely, you cannot scroll nor click any buttons; even hovering over a button won't yield a reaction. But after the applet loads which is about 5 to 10 seconds, the page unfreezes.

My questions are:

1) Is this "browser freeze" expected to happen? 2) Is there a way around this? I see websites like keepvid.com and savevid.com that also download videos, but have no 'browser freeze'. If there is something they are doing that I am not, I would really appreciate if someone tells me.

来源:https://stackoverflow.com/questions/14919280/java-browser-freeze-while-loading

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