/    Sign up×
Community /Pin to ProfileBookmark

How to execute javascript after all page is shown if you cannot use defer nor onload?

Exacly:
How to delay executing of javascript if you cannot use
defer nor body onload due to output overwrites content of
page ?

Example:
I have to show flash baner from outside adsever:

<SCRIPT LANGUAGE=”JavaScript”>
document.write(‘<SCR’+’IPT LANGUAGE=”JavaScript”
SRC=”http://adserver/path/script?parameters“; ></SCR’+’IPT>’);
</SCRIPT>

but browser waits until this script is downloaded to
execute it. The page is stoped in half of lenght. User must
wait to see rest of page.

I want browser to download and execute javascript only
after all page is shown.

defer=”defer” – doesn’t work because it clears page and
draws only baner code

body onload – the same as above

What to do?

Martin

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@CharlesDec 14.2002 — [font=georgia]I think that your best bet is going to be to load the thing in an IFRAME once the page has loaded. You will have to create a page in HTML with nothing but the ad and you will want to write the IFRAME element with JavaScript so that JavaScript free people won't have to see an empty IFRAME. Something like:[/font]

[font=monospace]

<script="text/javascript">

<!--

document.write('<iframe src="" height="100" width=400" name="ad"></iframe>');

window.onload = function () {document.frames.ad.location = 'ad.html'};

// -->

</script>

[/font]
Copy linkTweet thisAlerts:
@marcin_pauthorDec 14.2002 — You're right but I can not use IFRAME.

Adverts have different sizes and they are different type: for example expanding flash, big semi-transparent layer. If they are executed from IFRAME they are active (visible) only in IFRAME ?

Martin
Copy linkTweet thisAlerts:
@swonDec 14.2002 — Hi Martin,

I think the best way to do this, is to make an upstream site, set a invisible layer with your flash- banner inside. Then use the refresh-meta to go to next side an your banner is loaded.

Or secondary use a timer in jscript onload and load the banner after your timer settings.

regards

swon
×

Success!

Help @marcin_p spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...