Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Javascript include not working in Safari?

Reply
Thread Tools

Javascript include not working in Safari?

 
 
andrewljohnson
Guest
Posts: n/a
 
      01-26-2009
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
 
Reply With Quote
 
 
 
 
RobG
Guest
Posts: n/a
 
      01-26-2009
On Jan 26, 12:35*pm, andrewljohnson <andrewljohn...@gmail.com> wrote:
> 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.


--
Rob
 
Reply With Quote
 
 
 
 
Jorge
Guest
Posts: n/a
 
      01-26-2009
On Jan 26, 3:35*am, andrewljohnson <andrewljohn...@gmail.com> wrote:
>
> What am I doing wrong?
>
> Thanks,
> Andrew


That's what Safari is complaining about:

•Unmatched </head> encountered. Ignoring tag. http://cabin.trailbehind.com/
(line 700)

•Extra <body> encountered. Migrating attributes back to the original
<body> element and ignoring the tag.http://cabin.trailbehind.com/
(line 702)

•TypeError: Result of expression 'h[af]' [undefined] is not an object.

--
Jorge.
 
Reply With Quote
 
RobG
Guest
Posts: n/a
 
      01-26-2009
On Jan 26, 5:53*pm, Jorge <jo...@jorgechamorro.com> wrote:
> On Jan 26, 3:35*am, andrewljohnson <andrewljohn...@gmail.com> wrote:
>
>
>
> > 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.


--
Rob
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/* #include <someyhing.h> */ => include it or do not include it?That is the question .... Andreas Bogenberger C Programming 3 02-22-2008 10:53 AM
ASP Error 0126 include file not found, when using ".." in include file path Eric ASP General 10 01-11-2007 07:38 AM
ASP Error 0126 include file not found, when using ".." in include file path Eric ASP General 0 01-09-2007 06:54 PM
Re: the use of #include <a_file.h> v/s #include"a_file.cpp" Rolf Magnus C++ 2 11-28-2003 12:26 PM
#include "bar" negates #include <string> ; how to fix? Danny Anderson C++ 5 08-15-2003 06:38 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57