Javascript include not working in Safari?

A

andrewljohnson

Hi everyone,

If you visit this page in Safari, you will just see a paragraph of
text: http://cabin.trailbehind.com/

In Firefox, the search box and the side menu get rendered properly
(via javascript).

Here is a test I did. The first Alert fires, but not the second Alert.
Anyone have any thoughts on this mystery?

window.onDomReady(onReady);

function onReady() {
var menuWidget = renderHomeMenu();
...
}

//include via javascript include media/javascript/Widgets/
MenuWidget.js
function renderHomeMenu() {
alert(1) //NEVER FIRES
menuWidget = new MenuWidget('col2', false);
}


I also put an alert in the main body of MenuWidget.js, which should
fire when the include happens, but it doesn't. Also, when I check the
Safari console, it can't find function renderHomeMenu().

What am I doing wrong?

Thanks,
Andrew
 
R

RobG

Hi everyone,

If you visit this page in Safari, you will just see a paragraph of
text:http://cabin.trailbehind.com/

In Firefox, the search box and the side menu get rendered properly
(via javascript).

Here is a test I did. The first Alert fires, but not the second Alert.
Anyone have any thoughts on this mystery?

window.onDomReady(onReady);

function onReady() {
  var menuWidget = renderHomeMenu();
  ...

}

//include via javascript include media/javascript/Widgets/
MenuWidget.js
function renderHomeMenu() {
   alert(1) //NEVER FIRES
   menuWidget = new MenuWidget('col2', false);

}

I also put an alert in the main body of MenuWidget.js, which should
fire when the include happens, but it doesn't. Also, when I check the
Safari console, it can't find function renderHomeMenu().

What am I doing wrong?

What you failed to mention is that you are loading a total of 21
script files plus have a couple of script elements. Create a small
test that uses the *minimum* number of files (preferably one) and
isolate the error. Then maybe it can be discussed.
 
R

RobG

What am I doing wrong?
Thanks,
Andrew

That's what Safari is complaining about:

•Unmatched </head> encountered.[...]
•Extra <body> encountered.[...]

I think those are the result of invalid markup (for such as small
page, it has seriously broken markup, I guess the OP thought you could
use a DOCTYPE of XHTML 1.0 strict, then serve it as text/html and all
would be well).
•TypeError: Result of expression 'h[af]' [undefined] is not an object.

I don't get that far. I get a series of messages that script in the
page is making Safari unresponsive, so eventually I told it to stop.
Firefox has the same issue. Forcing a 1.2MB home page on visitors is
unreasonable, many will not even finish loading it before heading off
elsewhere.

Some of the map pages are nearly 3MB, with over 800kB of script.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top