Home >Web Front-end >HTML Tutorial >html loads so that it executes js_html/css_WEB-ITnose first

html loads so that it executes js_html/css_WEB-ITnose first

WBOY
WBOYOriginal
2016-06-24 12:15:381260browse

When loading a page, first run a piece of js. There is a judgment statement in js. After executing this js, other content in the page will be loaded. No other content will be loaded until the js is finished running. It needs to be satisfied that the same effect will occur when a mobile phone visits this page. Now I put the js in the head of the html and use the computer to access it to achieve this effect. However, if I use the mobile phone to access it, the js will not be able to run until the page is fully loaded. I would like to ask if you have any solutions.


Reply to the discussion (solution)

The mobile phone must support js.

The mobile phone must support js.

Now mobile browsers support js
Now js can run but the running time is wrong. It should not run after the entire page is loaded. What needs to be run is before loading the specific content of the page.

This part-time job is a matter of compatibility between different browsers.

Yes. Write all other content in one or several variables in JS. JS is almost running. If it needs to be output, then document.write it out. But sometimes it is easy to cause problems if document.write is not used properly. Just use innerHTML to assign it to a certain DIV in the page.

Okay... It depends on what kind of browser (UC, QQ) the mobile phone has, and you need to do some compatibility processing.

It’s best not to do this, although many so-called smart phones machine, but most of them can’t withstand the torment of JS. I tried it, but it can’t reach the speed required by the boss at all, except for the master level

There is still no good method. I just write js on the page now. head, but it always feels like it will still load all the pages and jump. That’s it for now. If you have any good ideas or methods, please communicate more. ^-^

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn