Solved

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

Posted on 2006-12-01
9
183 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
ID: 18053146
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
ID: 18053153
I'd go with the frameset idea every time.
0
 

Author Comment

by:probine
ID: 18053226
more details about the frame set please !!!
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 19

Expert Comment

by:VoteyDisciple
ID: 18053247
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
 

Author Comment

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

Author Comment

by:probine
ID: 18053924
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
ID: 18054128
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
ID: 18054284
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
ID: 18054311
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to dynamically set the form action using jQuery.

786 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