Why Won't My ASP.NET Hyperlink Work in IE?
Posted
by Giffyguy
on Stack Overflow
See other posts from Stack Overflow
or by Giffyguy
Published on 2010-04-21T14:50:23Z
Indexed on
2010/04/21
14:53 UTC
Read the original article
Hit count: 311
I'm making a very simple ad button system using ASP.NET 2.0
The advertisment is a 150x150px square that is displayed on "the r house."
(Scroll down a little and you'll see the bright green "Angry Octopus" on the right side of the screen.)
Now, I am not the administrator of "the r house." Instead, I am the administrator of angryoctopus.net
Therefore, I don't have the ability to change the ad display code on a whim. So I gave "the r house" this snippet of code to display our ad nicely, while still allowing me to customize the back-end code on my end:
<iframe src="http://www.angryoctopus.net/Content/Ad/150x150.aspx"
frameborder="0" width="150" height="150" scrolling="no"
style="padding: 0; margin: 0;"></iframe>
You'll find this snippet in the page source to "the r house."
On my side, the code looks like this:
<asp:HyperLink runat="server" NavigateUrl="http://www.angryoctopus.net/" Target="_top">
<asp:Panel ID="pnlMain" runat="server" BackColor="#D1E231"
style="padding: 0; margin: 0" Width="150" Height="150">
<asp:Image runat="server" ImageUrl="http://www.angryoctopus.net/Content/Ad/150x150.png"
BorderStyle="None" style="padding: 0; margin: 0" />
</asp:Panel>
</asp:HyperLink>
... and there's some insignificant back-end C# code for hit-counting.
This looks all well and good from the code standpoint, as far as I can tell. Everything works in Firefox and Chrome. Also, everything appears to work in IE8 in all of my tests. I haven't tested IE7.
But when you view "the r house" in IE(8) the hyperlink doesn't do anything, and the cursor doesn't indicate that the hyperlink is even there. Although you can see the target URL in the status bar.
I've considered the fact that "the r house" uses XHTML 1.0 Strict could be causing problems, but that would probably effect Firefox and Chrome right? (My aspx pages use XHTML 1.0 Transitional)
My only other theory is that some random CSS class could be applying a weird attribute to my iframe, but again I would expect that would effect Firefox and Chrome.
Is this a security issue with IE? Does anyone know what part of the r house's website could be blocking the hyperlink in IE? And how can I get around this without having to hard code anything on the r house's website? Is there an alternative to iframe that would do the same job without requiring complicated scripting?
© Stack Overflow or respective owner