.js file in body works but not in head of extra .html file

4 posts, 0 answers
  1. Markus
    Markus avatar
    205 posts
    Member since:
    Nov 2005

    Posted 27 Nov 2013 Link to this post

    I making a new app in which I want to split the whole thing to different .html files.

    Now I might have an understanding problem.

    index.html is the base and pretty much out of the template box :-)

    test.html is another file
    test.js has only an alert("test"); in it

    now if I put the test.js in the <head> of test.html the alert will not show, but if I put the test.js in the <body> of test.html alert will trigger.

    Its kind of like the <head> section of the test.html is not loaded.

    I am of course switching from index.html to test.html#somediv

    Does that make sense to anyone?

    Markus
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 27 Nov 2013 Link to this post

    Hi Markus,

    The behavior you describe is by design and expected one. You can find the explanation of this behavior in  the Kendo UI remote view documentation.

    Regards,
    Steve
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  3. Markus
    Markus avatar
    205 posts
    Member since:
    Nov 2005

    Posted 27 Nov 2013 Link to this post

    Thanks Steve

    Comming from Web design I still have a lot to learn.

    Would you recomend to include the test.js in the head of the index.html or in the body of the test.html?

    Markus
  4. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 27 Nov 2013 Link to this post

    Hi Markus,

    Depends on what you would do in the javascript. The docs I references explain your options:

    Inline style elements, inline script elements, and mobile layout definitions will be evaluated and appended to the application. The elements must be available in the root of the response, or nested inside the body element.Scripts and styles from the head element (if present) will not be evaluated.

    If the remote view needs an additional scripting (widget initialization/binding) logic, it may be defined in the view init event handler, in the AJAX response.


    Regards,
    Steve
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
Back to Top