Solved

How to have a link on a web page that when clicked doesn't do anything ?

Posted on 2006-12-01
9
178 Views
Last Modified: 2010-04-06
I would like to be able to have a link on my page. That link is a regular link, but when clicked it should not take me to a new location. Instead, it should send the http request, but expect nothing in return.

Is it possible ?
How ?
0
Comment
Question by:probine
  • 4
  • 4
9 Comments
 
LVL 19

Expert Comment

by:VoteyDisciple
Comment Utility
There's no native HTML way of tricking the browser into sending a request without getting a response, so you'd have to either:
(a) Use Javascript to do it (AJAX techniques)
(b) Get the response the usual way, but hide it somewhere unimportant.  You might, for instance, create a frameset for just this page, with one invisible frame.  Then targeting the link there would have no visible effect.
0
 
LVL 5

Expert Comment

by:dasmaer
Comment Utility
I'd go with the frameset idea every time.
0
 

Author Comment

by:probine
Comment Utility
more details about the frame set please !!!
0
 
LVL 19

Expert Comment

by:VoteyDisciple
Comment Utility
Create a page called, say, container.html, which contains the following INSTEAD OF a <body>:

<frameset rows="0,*">
    <frame name="invisible" src="somewhere.html">
    <frame name="main" src="regular-page.html">
</frameset>


Keep your existing content in regular-page.html, but change the link so it looks like:
<a href="page-to-load.php" target="invisible">Click to Not See Anything Change!</a>

(noting the added target="" attribute)

It's critical, then, that links elsewhere in your site link to container.html, NOT to regular-page.html.  If this is a site that's been around a while, you may want to change it so the existing filename is the one that puts out the <frameset>, and a new filename (which nobody will really ever even see) is the one with the content.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:probine
Comment Utility
I guess you are in the right direction, but your explanation is confusing... please explain again !!!
0
 

Author Comment

by:probine
Comment Utility
Let me put ir this way:

I have a page called "index.html". Somewhere in this page there is a link to "test.html".

When I click on the link to "test.html" the request should be sent, but nothing should change in the browser. I mean, the index.html page should still be there as it was before clicking on the link.
0
 
LVL 19

Accepted Solution

by:
VoteyDisciple earned 195 total points
Comment Utility
Ok, do this exactly:

1.  Rename index.html to content.html (leave the file exactly the same, but change its name to content.html)
2.  Create a new file called index.html
3.  In index.html, put...
   (a) <html> and </html> tags, like usual
   (b) The same <head> section as you have in content.html
   (c) The following code where you would normally put the <body> (this page will not have a <body> )

<frameset rows="0,*">
    <frame name="invisible" src="content.html">
    <frame name="main" src="content.html">
</frameset>

4.  In content.html (which, remember, used to be your index.html) change the link to look like:
<a href="test.html" target="invisible">Click to Not See Anything Change!</a>
0
 

Author Comment

by:probine
Comment Utility
It does work.

What in the world is going on there... I don't understand how it does it.

Explain ???
0
 
LVL 19

Expert Comment

by:VoteyDisciple
Comment Utility
Try changing the frameset to use <frameset rows="50%,*"> so you can actually see both frames.  You'll see it's really loading test.html in the other frame exactly the way you'd expect.  By setting the size of the frame to zero, however, that has no visible impact.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Article by: Matthew
I am a very big proponent of technology compliance standards and strive to meet such criteria in all of my work. That includes my site, which is 100% XHTML 1.0 compliant as determined by the World Wide Web Consortium. https://www.matthewstevenkel…
I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now