On one webpage, IE 11 is correctly styling certain visited hyperlinks while failing to do so for others

Although I acknowledge that others have asked similar questions, none seem to address the exact issue I am facing, nor do they offer practical solutions or clear explanations.

Issue

I'm encountering a problem where some visited hyperlinks in IE 11 follow my :visited CSS rules while others do not. These links are all on the same page.

The hyperlinks correctly adhere to CSS :visited when leading to external websites, but fail to do so when pointing back to pages within my application, specifically when accessed through IIS 8.5 in IE 11. Interestingly, there are no issues when working locally with links directed to localhost on Visual Studio 2017’s default web server.

This behavior is unique to IE 11 and affects only hyperlinks to pages served by our IIS 8.5 web server. It seems that IE struggles to recognize these pages in its browsing history.

Speculation

My suspicion is that this could be related to how different web servers serve content, particularly in terms of HTTP response headers (refer to the 4th paragraph under Conclusion).

Application Code

The following code snippet is from my application. The hyperlinks should display in red once visited, which works fine except for the mentioned scenario.

ASP.NET

<asp:GridView runat="server" ID="resultsGridView" CssClass="results-grid">
    <Columns>
        <asp:HyperLinkField 
            HeaderText="Item #"
            DataNavigateUrlFormatString="~/ItemDetails.aspx?id={0}"
            DataNavigateUrlFields="ItemId" 
            DataTextField="ItemId" 
            ItemStyle-CssClass="item-number">
        </asp:HyperLinkField>
        <asp:BoundField>...</asp:BoundField>
    </Columns>
    <AlternatingRowStyle>...</AlternatingRowStyle>
</asp:GridView>

CSS

.results-grid .item-number {
    font-weight: bold;
    white-space: nowrap;
}

.results-grid .item-number a:visited {
    color: red;
}

I went ahead and created a test page with hardcoded links, where three go to external sites and two replicate the IIS-served links from the grid view.

<!DOCTYPE html>
<html>
    <head>
        <style type="text/css">
            a:visited {
                color: red;
            }
        </style>
    </head>
    <body>
        <a href="https://www.w3schools.com">W3Schools Home</a><br/>
        <a href="https://www.w3schools.com/html/">W3Schools HTML Tutorial</a><br/>
        <a href="https://www.w3schools.com/css/">W3Schools CSS Tutorial</a><br/>
        <a href="https://example.com/ItemDetails.aspx?id=201725">201725</a><br/>
        <a href="https://example.com/ItemDetails.aspx?id=201774">201774</a>
    </body>
</html>

After testing each link, the external site links showed up as red (as expected), while the application links did not (only in IE 11).

(When viewed in Edge, none of the links remained red, but let's focus on IE for now.)

Conclusion

I am unable to pinpoint why IE fails to honor :visited for certain links on the same page while doing so for others.

The issue is not related to using https, as all links in my test page are https.

It also doesn't depend on whether the visited pages appear in the browser history - all link URLs show up in history.

The browser caching setting does not seem to affect this behavior. Despite this, it's worth noting that IIS appends Cache-Control: private to every HTTP response, although local browser caching should remain unaffected. This peculiar behavior remains unexplained.

To reiterate, :visited works flawlessly in other browsers and even in IE for external sites and local links. The anomaly persists exclusively with links to the app hosted on IIS.

If anyone can provide insight into this phenomenon and help me resolve it, I would greatly appreciate it!

Answer №1

iframe and eliminating the target attribute, I found that IE 11 finally recognized the :visited pseudo-class when the links were accessed within the frame and the page was subsequently refreshed.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Bootstrap arranges checkboxes into three evenly spaced columns and centers them within a form

Having trouble organizing my checkboxes into 3 columns and centering them within the form perfectly. Current layout: Click here for image Desired look: Click here for image HTML: ` <form action="/signup" method="POST" ...

"Utilizing AngulaJS to apply a class to the parent element when a radio button is

I'm wondering how I can assign a class to the parent div of each radio button in a group? You can find the code below and view the corresponding JSFiddle here. Here is the HTML: <div class="bd"> <input type="radio" ng-model="value" val ...

Tumblr post not automatically playing flash content

I am facing an issue with embedding a flash object on my tumblr blog (Billy's audio player) where I have to click a white play button for the object to work properly. This problem seems to occur specifically in Chrome and Edge browsers, as other websi ...

Swap a jQuery class with another if the class for ul li is currently active

I am currently developing a form builder and I would like to customize the appearance, specifically changing the color of the text. I want the text to be white when the class is set to active, and black when the class is not active. Is there a way to achi ...

Modify the background hue of the checkbox to resemble a button when selected

Is there a way to create a checkbox that resembles a button in appearance? I have managed to achieve this, but I am facing an issue with changing the background color of the button when it is checked. Currently, the button turns light-grey when checked, bu ...

When styled with an id, the DIV element does not inherit styles from a CSS class

I seem to be facing an issue with the code below, possibly due to using both class and id in the same div. Despite knowing they are meant to work together. For more information: Can I use DIV class and ID together in CSS? .PB { position: relative; ...

Adding Bootstrap to a button is a simple process that can enhance the

I am new to using Bootstrap and have a question. I am currently working with CodeIgniter for my website, and I have added the Bootstrap files to the asset folder along with my CodeIgniter file. I want to incorporate Bootstrap CSS into the following code: ...

"Safari browser may hide placeholder text, making it invisible to viewers

When adding color to the placeholder, I utilize this CSS property: .pro_heading input::-webkit-input-placeholder { color: #777; } However, it appears that in Safari, the color is not visible. ...

What is the best way to verify the font-family using JavaScript?

To verify if the user has installed the font family, we can run a JavaScript function with AngularJS. I am using a Typekit font and have only loaded this service for users who do not have this specific font. ...

Creating a layout in jQuery Mobile with two HTML <input type="button"> elements positioned side by side and each taking up 50% of the screen

After trying numerous strategies, I am still struggling to place two buttons next to each other evenly: <input type="button" value="This week's Schedule" onclick= 'window.location.href = dic[current_sunday]' /> <input type="button ...

When you hover over them, Material UI icons shrink in size due to the Border

I've been working on a React application that includes Material UI icons in the header. My goal is to add a border at the bottom of each icon when hovered over, but currently, the borders are too close to the icons. Another problem I'm facing is ...

What is the best way to customize the appearance of these two images within a div element?

While working on a small website project during my internship, I initially used an inline stylesheet. However, upon my boss's recommendation, I switched to an external stylesheet. Now, I'm trying to figure out how to style the two images within d ...

Alignment of inputs remains stubbornly off-center despite floating left

My main goal is to have all my inputs aligned to the left for a clean and organized look, similar to the image provided below: Despite my efforts to float the inputs and paragraphs to the left, I am facing an issue where they do not align properly. Instea ...

Trouble arising when implementing media queries alongside jQuery

When the screen size is 768px, I need to trigger the code below by clicking on the next button. However, an issue arises when trying to revert back to the original style after changing the screen size: $(document).ready(function() { alert(); $ ...

Strange occurrence with z-index, list items that are floating are not being displayed on top of the heading

I have come across a unique problem with z-indexes that I have never experienced before. To address one common speculation right away: the positioning for each element with a z-index is already set properly, so that's not the issue. Despite my efforts ...

Python / Selenium: Struggling to locate element by class name in Internet Explorer

I'm brand new to using selenium in Python and I'm struggling to figure out how to click on elements in Internet Explorer. Specifically, I am trying to click on an element with the class "drop_text2" but I can only see that in the inspect element ...

How can I eliminate the border appearance from a textfield fieldset component in Material-UI?

I have been struggling to remove the border using CSS code I found on Stack Overflow, but unfortunately, the issue persists. If anyone could kindly assist me in fixing this problem, I would be extremely grateful. Can someone please advise me on the specif ...

AngularJS Treeview with Vertical Line Styling using CSS

Struggling with styling, I am attempting to create a tree view in AngularJS. Currently, I am facing an issue aligning vertical and horizontal lines for the tree items. Check out my Codepen for reference. <html lang="en"> <head> <meta cha ...

Tips for selectively applying CSS to a single HTML file

I'm currently working on a website utilizing AngularJS and Plangular to develop a unique Soundcloud Player. This is how I incorporate my template: <body> <div id="container"> <div id="header" ng-controller="HeaderCtrl"><div ...

Tips for properly aligning blockquote opening and closing quotation marks

We are currently implementing custom styles for beginning and end quotes in a string using the <blockquote> tag. However, we are having issues with the alignment, as the opening quote appears before the text and the closing quote is at the end of the ...