Solved

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

Posted on 2006-12-01
9
184 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
From XSL to Word - How add a page break? 5 39
Microsoft Edge 9 102
Create associate webpages / websites 3 90
Adjust the position 3 65
Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
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 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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

809 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