We help IT Professionals succeed at work.

Trying to add Javascript to Joomla page

Member_2_7966113
on
221 Views
Last Modified: 2017-04-08
Hello Experts,

Whenever I attempt to add the following script to a page I created in Joomla it keeps on disappearing, can someone let me know why?

<script type="text/javascript">  var appInsights=window.appInsights||function(config){    function i(config){t[config]=function(){var i=arguments;t.queue.push(function(){t[config].apply(t,i)})}}var t={config:config},u=document,e=window,o="script",s="AuthenticatedUserContext",h="start",c="stop",l="Track",a=l+"Event",v=l+"Page",y=u.createElement(o),r,f;y.src=config.url||"https://az416426.vo.msecnd.net/scripts/a/ai.0.js";u.getElementsByTagName(o)[0].parentNode.appendChild(y);try{t.cookie=u.cookie}catch(p){}for(t.queue=[],t.version="1.0",r=["Event","Exception","Metric","PageView","Trace","Dependency"];r.length;)i("track"+r.pop());return i("set"+s),i("clear"+s),i(h+a),i(c+a),i(h+v),i(c+v),i("flush"),config.disableExceptionTracking||(r="onerror",i("_"+r),f=e[r],e[r]=function(config,i,u,e,o){var s=f&&f(config,i,u,e,o);return s!==!0&&t["_"+r](config,i,u,e,o),s}),t    }({        instrumentationKey:"b8fd81a5-3f5e-4e1b-a117-911cd608797e"    });           window.appInsights=appInsights;    appInsights.trackPageView();</script>

Open in new window


I'm trying to add it to:

<h1 class="title textleft default textDefault" style="margin-bottom: 20px; border: 0px; font-size: 24px; font-family: 'My Font One', 'Open Sans', sans-serif; vertical-align: baseline; line-height: 27.600000381469727px; text-transform: none;"><span style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; vertical-align: baseline;">eLab Overview</span>
</h1>
<div class="row-fluid bottom-padding-yes " style="margin: 0px -20px; padding: 0px; border: 0px; font-size: 13px; font-family: 'Open Sans', sans-serif; vertical-align: baseline; width: auto; max-width: none; min-width: 0px; color: #444444; line-height: 23px;">
	<div class="span8" style="margin: 0px; padding: 0px 20px; border: 0px; font-family: inherit; vertical-align: baseline; float: left; position: relative; width: 653.328125px;">
		<div class="inner-content" style="margin: 0px; padding: 0px 0px 50px; border: 0px; font-family: inherit; vertical-align: baseline;">
			<div class="column-text" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; vertical-align: baseline;">
				<h2 style="line-height: normal; margin-top: 12pt; margin-right: 0cm; margin-bottom: 0.0001pt;"><strong><span style="font-size: 14pt; font-family: 'Thorndale for VST', serif;">Remote Labs.</span></strong>
				</h2>
				<h1 class="componentheading workbookcontent" style="margin-top: 12pt; margin-right: 0cm; margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 14pt; font-family: 'Thorndale for VST', serif;">The Keyloop Learning Lab (&ldquo;eLab&rdquo;) offers worldwide remote access to private cloud environments that offer a testing and network simulation platform for deploying, configuring and troubleshooting<strong>&nbsp;Check Point Firewall, &nbsp;Palo Alto Networks, F5 BIG IP, Cisco Networks&nbsp;</strong>and&nbsp;<strong>Riverbed Network&nbsp;</strong>appliances.</span>
				</h1>
				<h2 style="margin-top: 12pt; margin-right: 0cm; margin-bottom: 0.0001pt; line-height: normal;"><strong><span style="font-size: 14pt; font-family: 'Thorndale for VST', serif;">Online Labs.</span></strong>
				</h2>
				<p style="margin-top: 12pt; margin-right: 0cm; margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 14pt; font-family: 'Thorndale for VST', serif;">As a Keyloop student, you will have access to the Online Labs (elab) for the duration of the scheduled session. Throughout the online training session you will perform the step- by- step exercises contained in the workbook. The exercises can take as long as you wish and you can end or extend the session at anytime..&nbsp;</span>
				</p>
				<p style="margin-top: 12pt; margin-right: 0cm; margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p>
				<h1 class="title textleft default textDefault" style="font-size: 24px; line-height: 27.6000003814697px; margin-bottom: 20px; font-family: 'My Font One', 'Open Sans', sans-serif; text-transform: none; border: 0px; vertical-align: baseline;"><span style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; vertical-align: baseline;">How It Works</span>
				</h1>
			</div>
			<div class="column-text" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; vertical-align: baseline;">
				<p style="margin-top: 12pt; margin-right: 0cm; margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 14pt; font-family: 'Thorndale for VST', serif;">There are three Steps</span>
				</p>
				<p style="margin: 12pt 0cm 0.0001pt 30px; line-height: normal;"><strong><span style="font-size: 14pt; font-family: 'Thorndale for VST', serif;">1: Login to the eLab from your Windows PC.</span></strong>
				</p>
				<p style="margin: 12pt 0cm 0.0001pt 30px; line-height: normal;"><strong><span style="font-size: 14pt; font-family: 'Thorndale for VST', serif;">2: Carry out the exercises from any of the courses you select.</span></strong>
				</p>
				<p style="margin: 12pt 0cm 0.0001pt 30px; line-height: normal;"><strong><span style="font-size: 14pt; font-family: 'Thorndale for VST', serif;">3: Start learning.</span></strong>
				</p>
				<p style="margin-top: 12pt; margin-right: 0cm; margin-bottom: 0.0001pt; line-height: normal;">&nbsp;<span style="font-size: 14pt; font-family: 'Thorndale for VST', serif;">The eLab environment contains isolated network environments, referred to as &ldquo;vPods&rdquo;, which will be assigned to each student.&nbsp;</span>
				</p>
				<p style="margin-top: 12pt; margin-right: 0cm; margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 14pt; font-family: 'Thorndale for VST', serif;">The remote labs (eLabs) is designed to be accessible worldwide using a remote desktop (RDP) connection to a Windows 7 client PC virtual machine in your eLab pod. Once you connect to the elab, all configuration tasks will be performed using the remote desktop session, which will run in full screen mode on your PC.</span>
				</p>
				<p style="margin-top: 12pt; margin-right: 0cm; margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p>
				<h1 class="title textleft default textDefault" style="font-size: 24px; line-height: 27.6000003814697px; margin-bottom: 20px; font-family: 'My Font One', 'Open Sans', sans-serif; text-transform: none; border: 0px; vertical-align: baseline;"><span style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; vertical-align: baseline;">Scheduling a Lab Session</span>
				</h1>
			</div>
			<div class="column-text" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; vertical-align: baseline;">
				<p style="margin-top: 12pt; margin-right: 0cm; margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 14pt; font-family: 'Thorndale for VST', serif;">To schedule your keylooplab session, log into your Members account, and select the &nbsp;session you wish to book <span style="color: #0000ff;"><a href="index.php/ed-serv/settings-2">here</a>.</span> You will be provided with&nbsp;a step-by-step guide to booking a lab session.</span>
				</p>
				<p style="margin-top: 12pt; margin-right: 0cm; margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p>
				<h1 class="title textleft default textDefault" style="font-size: 24px; line-height: 27.6000003814697px; margin-bottom: 20px; font-family: 'My Font One', 'Open Sans', sans-serif; text-transform: none; border: 0px; vertical-align: baseline;"><span style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; vertical-align: baseline;">Pricing</span>
				</h1>
				<h4 style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 14pt;"><span style="font-family: 'Thorndale for VST', serif;">All lab sessions are scheduled in one hour sessions at $2</span><span style="font-family: 'Thorndale for VST', serif;"><span style="color: #444444; font-family: 'Thorndale for VST', serif; line-height: normal;">0USD&nbsp;</span>per hour. The last 15 minutes of your session is for intersession (the rack is reset for the next student). For example, if you reserve a 12-hour session, your session will last 11.45 hours; if you reserve a 1hour session, your session will last 0.45 hour(s).</span> </span>
				</h4>
				<h4 style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 14pt;"><span style="font-family: 'Thorndale for VST', serif;"></span></span>&nbsp;</h4>
				<h3 class="title textleft default textDefault" style="font-size: 24px; line-height: 27.6px; margin-bottom: 20px; font-family: 'My Font One', 'Open Sans', sans-serif; border: 0px; vertical-align: baseline;"><span style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; vertical-align: baseline;">Course Details</span>
				</h3>
				<p><span style="color: #444444; font-family: 'Open Sans', sans-serif; font-size: 18.6667px; line-height: 23px;">For a&nbsp;</span><span style="color: #444444; font-family: 'Open Sans', sans-serif; font-size: 18.6667px; line-height: 23px;"><strong><span style="color: #ff0000;">YouTube</span> </strong>&nbsp;demonstration on how to (a) Book the lab, (b) Access the Virtual Riverbed Lab and (c) Carry out exercises click&nbsp;</span><strong style="color: #444444; font-family: 'Open Sans', sans-serif; font-size: 18.6667px; line-height: 23px;"><span style="color: #ff0000;"><a href="https://youtu.be/UB3BpU44wA4">here</a>.</span></strong>
				</p>
				<p style="color: #444444; font-family: 'Open Sans', sans-serif; font-size: 13px; line-height: 23px;"><span style="font-size: 14pt;">To view the courses available, the exercises and lab prices, click&nbsp;<a href="index.php/ed-serv/settings-2"><strong>here</strong></a>.</span>
				</p>
				<p style="margin-top: 12pt; margin-right: 0cm; margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p>
				<h1 class="title textleft default textDefault" style="font-size: 24px; line-height: 27.6000003814697px; margin-bottom: 20px; font-family: 'My Font One', 'Open Sans', sans-serif; text-transform: none; border: 0px; vertical-align: baseline;"><strong style="font-family: 'My Font One', 'Open Sans', sans-serif; font-size: 24px; line-height: 27.6px;"><span style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; vertical-align: baseline;">Ready to get started today? <span style="color: #444444; font-family: 'Thorndale for VST', serif; font-size: 14pt; line-height: normal;"><span style="text-decoration: underline;"><span style="color: #339966;"><a href="http://keyloop.co.uk/index.php/component/users/?view=registration" style="color: #339966;">Register</a></span></span> for no obligation membership.</span></span></strong>
				</h1>
			</div>
		</div>
	</div>
</div>
<h2 class="title textcenter style1 textDefault" style="margin-bottom: 20px; border: 0px; font-size: 30px; font-family: 'My Font One', 'Open Sans', sans-serif; vertical-align: baseline; line-height: 37.5px; text-align: center;"><img src="images/booking.jpg" alt="booking" width="513" height="179" style="font-family: inherit; font-size: 24px; line-height: 27.6000003814697px;" />
</h2>
<!-- Tend Code -->
<p>&nbsp;</p>

Open in new window


But no matter where I place the script it disappears after  save

Regards
Comment
Watch Question

Carlos LlanosIT Manager

Commented:
It appears you might have a filter that is stripping that out.

If you go to:

Global Configuration -> Text Filters
Then find the user group you are assigned to. If it doesn't have "No Filtering" it will get stripped out.

If you are a Super User it should be set to that by default I believe.

How are you adding all of the HTML currently? In an article?

I have a write up HERE that explains how you can add custom css and js to any Joomla page using JUMI.

Author

Commented:
Hi Andrew,

Thanks for pointing that out. I will check it and let you know.

Author

Commented:
Hi Andrew,

I'm a super user, please see attached
java.png

Author

Commented:
Hi Andrew,

I plugged in the code you suggested

<?php
$document =& JFactory::getDocument();
$document->addStyleSheet('files/css/default.css');
$document->addScript('files/scripts/test.js');
?>

Open in new window


I then tried to add my extra code, but it still disappeared :-(

Author

Commented:
How are you adding all of the HTML currently? In an article?

In the source code of an article

Author

Commented:
Hi Andrew,

I have added Jumi but I'm still having issues adding javascript.

Can you provide some guidance please
IT Manager
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Carlos LlanosIT Manager

Commented:
No response from user after this comment.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.