Solved

JavaScript Function

Posted on 2014-12-02
2
91 Views
Last Modified: 2014-12-09
Hello,

We are looking for assistance writing a JavaScript IF statement that will be embedded into all html pages within a website and will execute the script below if the page URL being accessed matches a particular page.

For example:

If page url = http://www.website.com/page1.html

Then

<!-- Conversion Pixel - DO NOT MODIFY -->
<script src="https://secure.website.com" type="text/javascript"></script>
<!-- End of Conversion Pixel -->

Thanks
0
Comment
Question by:PlumInternet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40477509
<script>
if(location.href=="http://www.website.com/page1.html"){
	var head = document.getElementsByTagName('head')[0];
	var dynJs = document.createElement("script");
	dynJs.src = "https://secure.website.com";
	head.appendChild(dynJs);
}
</script>

Open in new window

0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question