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

Posted on 2006-12-01
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 ?
Question by:probine
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
LVL 19

Expert Comment

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.

Expert Comment

ID: 18053153
I'd go with the frameset idea every time.

Author Comment

ID: 18053226
more details about the frame set please !!!
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 19

Expert Comment

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">

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.

Author Comment

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

Author Comment

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.
LVL 19

Accepted Solution

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">

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>

Author Comment

ID: 18054284
It does work.

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

Explain ???
LVL 19

Expert Comment

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.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SAMI File <SYNC Start = (number of millisecond)> Question 3 87
AngularJS directive issue 6 80
Adjust the position 3 70
Where do I learn ES6? 3 81
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…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

749 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