Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hyperlinked Images

Status
Not open for further replies.

Dynapen

Programmer
Apr 20, 2000
245
0
0
US
Here's the problem. Website is a issueTracker. Uses a roster type list of issues, with some links in the last colums for "delete, edit, etc...."
Currently each link is done with a image,
Code:
<a href="test.do?id=8"><img src="/images/edit.png"/></a>
Pretty basic stuff. Image shows correctly, and the links work fine in FF. But when I go to IE, I get the following results.

Cursor correctly changes to the "finger" cursor like it does on any other link.
Right-click and it brings up the "open link" options on the menu.
In the status bar, when hovering over the link, shows the correct http address to go to.

But left-clicking on the link does nothing.

If I change the link from a image to text, it works fine. If I click on a image link that does not include a querystring, it works fine.

But the combination of image-link and querystring seems to cause it problems. Unfortunately, i can't test to see if this is a environment or code problem, as the IE settings are managed by SMS and the Network Admins.

Does anyone know of a setting that would cause this? Or is that possibly a bug in IE? (6.0.28 is the version)

Any help is appreciated.
 
But left-clicking on the link does nothing.
I took the line of code you posted and wrapped it in a simple test page continaing just the bare minimum requirements for HTML... no doctype.

Left-clicking the image (which admittedly was missing from my test page) in IE attempted to load the page shown in the <a href> without the ?id=8 part. Firefox attempts to load the page correctly with the ?id=8 part.

So whilst left-clicking on the link does do something in IE... it's not doing what we would all expect. I haven't heard of this problem before (and I'm very very surprised to see this behaviour).

I am guessing you may have to add an onclick to the image to handle IE properly.

Anyone else?
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
I will try to paste more of the full code later.

BillyRay- Can't escape the ? becuase Struts is actually generating the link. But even in HTML, the ? is reserved, and I have a number of other links with querystrings that work fine. The image links work fine once I make them text with out altering the actual href. So that can't be the problem.

BabyJeffy- In mine it doesn't even do anything, becuase other wise the server logs would show the attempted request to the page (without the associated with querystring) which would cause the page to error...... I can't get IE to do anything.

There shouldn't be anyreason to have to go to JavaScript to make this work. I have seen IE work correctly with this type of code in thousands of places, just can't figure out why it won't work here.



Yeah.....I'm going to need you to go ahead and come in on Saturday.....Yeah.....That'd be great.
 
Believe it or not, I think the problem is to do with the file extension in the URL!

Currently it ends in .do (common for struts web apps). I took my test page and changed the URL to end in .htm and suddenly IE is now requesting the URL properly (with the ?id=8 correctly).

There was no difference if I escaped the ? or not in my scenario... and this should never be a problem for the kind of URL you are using, anyway.

I know this is not a solution for you (since you are stuck with .do files for your web app) -- but it may help us stumble on the answer!

Next...
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
Actually I found it, was mainly becuase I overlooked something.

The Struts tag <html:image> was correctly displaying the image, and everything else, but it also create a image type input box in the source. I just didn't look at it closely enough. Turns out it just another case of IE not being standard, which is why it worked on Firefox, but not IE.

Hopefully one of these days MS will start to follow the standards that they preach about.

Yeah.....I'm going to need you to go ahead and come in on Saturday.....Yeah.....That'd be great.
 
I don't equate Struts creating a input box to IE not being standard. I equate the fact that it worked correctly on Firefox (a standards-adherent browser) and not on IE (a non-compliant browser) to it being a IE problem. And my guess would be that Opera, Gecko, or almost any other browser would have interpreted it the same way Firefox did.


It's no secret that IE does what it wants, regardless of what the W3C says.



Yeah.....I'm going to need you to go ahead and come in on Saturday.....Yeah.....That'd be great.
 
Anyone interested in attempting to explain why the following html does not request the ?id=8 when the href is clicked in IE (windows) -- yet does request the full href in FF?
Code:
<html><head><title>Test</title></head><body>
<a href="test.do?id=8"><img src="image.png"/></a>
</body></html>
If you change the href to request a file ending in .htm (instead of .do) it works fine in both FF an IE (and requests the ?id=8 as part of the href).
Code:
<html><head><title>Test</title></head><body>
<a href="test.[COLOR=red][b]htm[/b][/color]?id=8"><img src="image.png"/></a>
</body></html>
Anyone?
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
A co-worker, when dynamically building a PDF to display on the browser, found that if he requested the URL (.do for a struts action in this case) through Firefox, it only happened once. In IE, the request came through twice.

More than likely what you are seeing is IE trying to validate some part of the request first, and the when that passes, then send the rest of the information (the querystring in this case). Because in your example the first part of the request (especially for the .do) isn't valid, it doesn't try the second, and therefore dumps the querystring. The .htm file on the other hand (which was probably the file that contained the link anyway) did exist so IE could finish processing.

Weird situation, but that IE for you./

Yeah.....I'm going to need you to go ahead and come in on Saturday.....Yeah.....That'd be great.
 
Just as an FYI... we've just experienced a similar issue at work. We had many URLs like this:

Code:
<a href="../../../somefile.htm">blah</a>

which had a background image. The image was not showing in IE.

One of the links was:

Code:
<a href="../../../somefile.do;jsessionid=223089ab694a48381517">blah</a>

and that was working fine. When we modified our code to append the session ID to the .htm files as well:

Code:
<a href="../../../somefile.htm;jsessionid=223089ab694a48381517">blah</a>

then all seemed to start working as expected.

Maybe a similar fix would work for you?

Hope this helps,
Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top