I guess the first question is why are you trying to add a script tag in the content section?
Normally the content section is reserved for purely content ( i.e. editable by a non-techie ) so I would definitely advise trying to avoid adding any script in that section.
You should add your script tags to your templates ( master pages ) or if you need to make them dynamic, the best way would be to include an XSLT macro and add your script instruction in the macro.
Sometimes you need a script that makes sense in a context of a single page. Creating a separate macro or template is both a waste of time and a problem for maintainability. For example, if a script references a particular element on the page, clearly you would want to keep this script somewhere close to that element, not in a separate file. I'd vote for making this configurable.
JavaScript not working in the Content Section
I am trying to insert at little script on my webpage, by inserting it under HTML on the Content tab in the Content Section.
The script could look like:
<script type="text/javascript">document.write("test test");</script>
But umbraco changes it to:
<!-- document.write("test test"); // -->
I am using umbraco v 4.0.3.
Why are umbraco changing my script?
And how do I get it to work?
Best Regards
Bjerner
Hi Bjerner,
I guess the first question is why are you trying to add a script tag in the content section?
Normally the content section is reserved for purely content ( i.e. editable by a non-techie ) so I would definitely advise trying to avoid adding any script in that section.
You should add your script tags to your templates ( master pages ) or if you need to make them dynamic, the best way would be to include an XSLT macro and add your script instruction in the macro.
Cheers,
Chris
I was trying to create a script to obfuscated e-mail-address to avoid that they are crawled by spam robots.
And I didn't see any reason to use a lot of time creating XSLT macros, when the HTML editor was available.
Can it easily be done by XSLT?
Best Regards
Bjerner
Read this. Use contact forms with some CAPTCHA tech instead of obfuscating email addresses.
Sometimes you need a script that makes sense in a context of a single page. Creating a separate macro or template is both a waste of time and a problem for maintainability. For example, if a script references a particular element on the page, clearly you would want to keep this script somewhere close to that element, not in a separate file. I'd vote for making this configurable.
is working on a reply...