This is a migrated thread and some comments may be shown as answers.

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

3 Answers 28 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Markus
Top achievements
Rank 2
Markus asked on 27 Nov 2013, 08:47 AM
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

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 27 Nov 2013, 01:08 PM
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.
0
Markus
Top achievements
Rank 2
answered on 27 Nov 2013, 01:13 PM
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
0
Steve
Telerik team
answered on 27 Nov 2013, 01:26 PM
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.
Tags
General Discussion
Asked by
Markus
Top achievements
Rank 2
Answers by
Steve
Telerik team
Markus
Top achievements
Rank 2
Share this question
or