Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 98
  • Last Modified:

JavaScript Function

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
PlumInternet
Asked:
PlumInternet
1 Solution
 
GaryCommented:
<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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now