Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2006-12-01
9
Medium Priority
?
199 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
[X]
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
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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:
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…

670 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