Jump to content

Detection Of The Presence Or Absence Of An Html Document


iwato

Recommended Posts

QUESTION: The following code is intended to discover the presence or absence of the document "functionality.html". If the document is discovered the jQuery statement $(this).getBrowserInformation(); is not suppose to run. If the page is absent the statement $(this).getBrowserInformation(); is suppose to run.What happens is that the statement $(this).getBrowserInformation(); always runs. Can you suggest the source of failure and a possible correction?

<script type="text/javascript">	$(document).ready(function() {		function optionalScript() {			var winloc = window.location.href;			if (winloc !== "functionality.html") {				$(this).getBrowserInformation();			}			else {}		}		optionalScript();		$('#today').toDate();		$('#clock').JSClock();		$('#duration').timePassed();		$('body').SVG_RoundiesIntializer();	});</script>

Roddy

Link to comment
Share on other sites

Alert the value of winloc and see why it doesn't equal "functionality.html". It's probably going to return the full URL, not just the filename.
Thank you for responding, justsomeguy. You were correct. The script window.location.href returns the entire URL. As a result, I looked for a different way of identifying the file uniquely that would be independent of the files relative or absolute location. I decided on the document.title property. Well, at least, for the moment, as I have stumbled on a new problem that I will post as another topic.Thanks.Roddy
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...