DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   JavaScript / DHTML / AJAX (http://www.daniweb.com/forums/forum117.html)
-   -   HTML Link without clicking (http://www.daniweb.com/forums/thread123681.html)

RFBourquin May 11th, 2008 12:43 pm
HTML Link without clicking
 
How can I link to another URL when my web page opens without clicking on "link"?
I'm just learning html and understand how to link using the anchor and href.
Example:

<html>
<body>

<p>
<a href="http://msm/com">
Click Here </a>
</p>

</body>
</html>

How can I get my webpage to open the link without having to have the "Click Here" present?

blater May 11th, 2008 5:38 pm
Re: HTML Link without clicking
 
You can either use a refresh meta-tag or you can set window.location in javascript.

Here is the javascript solution:
<html>
<head>
  <script type="text/javascript">window.location="http://msm.com";</script>
</head>
</html>

Here is the REFRESH solution:
<html>
<head>
  <META http-equiv="refresh" content="1;URL=http://msm.com">
</head>
<body>
    REDIRECTING YOU....
</body>
</html>

RFBourquin May 13th, 2008 12:21 pm
Re: HTML Link without clicking
 
Thanks very much. Both solutions work great.


All times are GMT -4. The time now is 11:18 pm.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC