Solved

JavaScript Function

Posted on 2014-12-02
2
84 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
2 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
Comment Utility
<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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write 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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now