View Full Version : How to stop double booting?

12-12-2010, 04:30 AM
Hey I am almost done with my API boot system and with the way I am calling new files it seems to double boot how can I stop this from happening as the page fully loads and that but the loader shown in the IE tab doesn't stop and it says '1 item remaining' and that never goes, both stay until you click anywhere on the document, so I was wondering if there is a way to stop this.

My code to call the js document in the file 'boot.js'.

var o = 'http://www.example.com/file.js';
document.write("<script src=\""+o+"\" type=\"text\/javascript\"><\/scr"+"ipt>");

And in index.html I have this script tag

<script type="text/javascript" src="http://www.example.com/boot.js"></script>

12-12-2010, 06:07 AM
This is just a shot in the dark, but try following the document.write line in boot.js with this:


12-12-2010, 03:16 PM
I'll give it a go but wouldn't that basicly close the file right after opening it which would result in the codes inside the included file being useless and unusable in boot.js

For example:

- file.js

// Creating printString function
function printString(o) {

- boot.js

// Setting the include URL
var o = 'http://www.example.com/file.js';

// Including the set URL
document.write("<script src=\""+o+"\" type=\"text\/javascript\"><\/scr"+"ipt>");

// Close include -- Unsure!

// Using included function inside pickString
function pickString(o) {
if(o == 1) {
printString('You chose string 1');
} else if(o == 2) {
printString('You chose string 2');

- index.html

<!DOCTYPE html>
<title>Untitled Document</title>
<script type="text/javascript" src="http://www.example.com/boot.js"></script>
<script type="text/javascript">
window.onload = (function() {
// Setting btn1 and btn2 as ID objects
var btn1 = document.getElementById('btn1'),
btn2 = document.getElementById('btn2');

// Checking and using btn1 and btn2 to pick a string
if(btn1) { btn1.onclick = (function(){pickString(1);}); }
if(btn2) { btn2.onclick = (function(){pickString(2);}); }
<input type="button" value="Alert 1" id="btn1" />
<input type="button" value="Alert 2" id="btn2" />

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum