0

Guys,

I'm having a little bit of a problem trying to display something when the URL is a specific one.

Basically purely for examples sake, if the URL is http://www.mydomain.com/hello.html I want it to display "Hello", and when it isn't I want it to redirect to another page.

I know how to do it in PHP, but I need to be able to do it in JavaScript. I applied the same principle on how I'd do it in PHP to JavaScript, and I'm not having much luck. He's what I have that doesn't work:

<script type="text/javascript">
var uri=location.href;

if(uri==http://www.mydomain.com/hello) {
     document.write("Hello");
}
else {
     window.location="http://www.mydomain.com/bye";
};
</script>

All your help is highly appreciated.

Thanks,
Brown.

Edited by brown23: n/a

1
Contributor
1
Reply
5
Views
6 Years
Discussion Span
Last Post by brown23
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.