Javascript include not working in Safari?

Discussion in 'Javascript' started by andrewljohnson, Jan 26, 2009.

  1. Hi everyone,

    If you visit this page in Safari, you will just see a paragraph of

    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?


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

    //include via javascript include media/javascript/Widgets/
    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?

    andrewljohnson, Jan 26, 2009
    1. Advertisements

  2. andrewljohnson

    RobG Guest

    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.
    RobG, Jan 26, 2009
    1. Advertisements

  3. andrewljohnson

    Jorge Guest

    That's what Safari is complaining about:

    •Unmatched </head> encountered. Ignoring tag.
    (line 700)

    •Extra <body> encountered. Migrating attributes back to the original
    <body> element and ignoring the tag.
    (line 702)

    •TypeError: Result of expression 'h[af]' [undefined] is not an object.
    Jorge, Jan 26, 2009
  4. andrewljohnson

    RobG Guest

    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).
    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

    Some of the map pages are nearly 3MB, with over 800kB of script.
    RobG, Jan 26, 2009
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.