2
rated 0 times
[
4]
[
2]
/ answers: 1 / hits: 89468
/ 9 Years ago, thu, january 7, 2016, 12:00:00
I want to check if the URL in a Browser contains the word Desktop (I startet the html file from the Desktop). Its url is: file:///C:/Users/Joe/Desktop/TestAlert.html
But there should appear an alert, but this doesnt works.
Here is my code:
<html>
<head>
<script type=text/javascript>
$(document).ready(function () {
if(window.location.href.contains(Desktop) > -1) {
alert(Alert: Desktop!);
}
});
</script>
</head>
<body>
<h1>Test001</h1>
</body>
</html>
I tested this in Firefox, Chrome and Internet Explorer.
It would be very nice, if someone can help me!
More From » javascript