1,105,334 Community Members

HTML Link without clicking

Member Avatar
RFBourquin
Newbie Poster
8 posts since Apr 2006
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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?

Member Avatar
blater
Light Poster
25 posts since Mar 2008
Reputation Points: 2 [?]
Q&As Helped to Solve: 7 [?]
Skill Endorsements: 0 [?]
 
0
 

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>
Member Avatar
RFBourquin
Newbie Poster
8 posts since Apr 2006
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks very much. Both solutions work great.

Question Answered as of 5 Years Ago by blater
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article