开发者

ASP.Net: Load Advertise after load page? // performance Issues

I have a big performance issue in my asp.net page. I have around 10-15 database querys on every page load, the page load is done in ~0,x seconds (very fast I think).

开发者_开发百科Since I add my advertisment:

  <script type="text/javascript">
                            adscale_slot_id = "xxxxx";
                        </script>
                        <script type="text/javascript" src="http://js.adscale.de/getads.js"></script>

My site-performance is very very high, it is around 1-2 seconds every page.

How to make it faster?

A idea is to load the advertise after the page is ready and loaded. Is that do-able?


Defer is one way to load ads after page has loaded. Other way is to use ASWIFT way which uses iframe to load ads parallel. Google uses this way to speed up their page loading. It has a few gotchas but worth the try.

Check out this presentation by them on Velocityconf. Don't let third parties slow you down

--Sai


Try adding the defer attribute to your script tag:

<script type="text/javascript" src="http://js.adscale.de/getads.js" defer="defer"></script>

This tells the browser to execute the script AFTER the page has loaded.


Load ads after page has loaded

When your advertisements are on a different web server it's always wise to load them after page has loaded. This way they won't slow down your page. If you use standard ad sizes, make sure your containers are appropriately sized so your page content won't reposition after ads load.

Advertisements loading

You can either load them on page ready by Javascript DOM manipulation (in jQuery that would be $(function(){ /* load */});) or use the DEFER script attribute on the tag itself.

The first being more powerful and the latter being simpler.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜