Strange HTML Link Tag Behavior

We encountered strange behavior when using the html tag. In fact, the problem was related to the misuse of the tag. As a result of this, the page was sent 3 times in Mozilla Firefox and 2 times in IE7. Here is the problem.

<link rel="stylesheet" type="text/css" title="Style" href=''/css/image.css'>

This was the code we used in one of our J2EE applications. When we checked the request and response (using HTTP Watch), we found out that the page was requested 3 times from the server. We found that an additional “ quote ” after href=causes the problem. We were unable to find out the reason why this caused multiple page views. Is this because the extra quote is hrefblank and because of this does the browser try to load styleclassfrom the same URL that loaded the page? Can someone please help figure out the reason why this happens? Any help would be greatly appreciated.

+3
source share
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>        
    </head>
    <body>
        <table width="100%" cellspacing="0" cellpadding="0" border="0" class="mainOutterTable">
            <tbody>
                <tr>
                    <td>
                        <table class="layoutColumn" cellpadding="0" cellspacing="0">
                            <tr>
                                <td style="width:100%;" valign="top">
                                    <table class="layoutRow" cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td valign="top" width="910">
                                                <table class="layoutColumn" cellpadding="0" cellspacing="0">
                                                    <tr>
                                                        <td style="width:100%;" valign="top">
                                                            <table class="layoutRow" cellpadding="0" cellspacing="0">
                                                                <tr>
                                                                    <td valign="top" width="294">
                                                                        <table class="layoutColumn" cellpadding="0" cellspacing="0">
                                                                            <tr>
                                                                                <td style="width:100%;" valign="top">
                                                                                    <a name="7_N1K8HIC0GOO780I2B1KASD3047"></a>
                                                                                    <div class="wpsPortletBody">
                                                                                        This is a sample textf 3.
                                                                                        <link rel="stylesheet" type="text/css" title="Style" href=''/>
                                                                                    </div>
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </tbody>
        </table>
    </body>
</html>

. alt text

5.2 http://www.apps.ietf.org/rfc/rfc3986.html#sec-5.2 , URI .   if (R.path == ""),                  T.path = Base.path;

0

Yahoo Developer. src:

When an empty string is encountered as a URI, it is considered a relative URI and is resolved according to the algorithm defined in section 5.2. This specific example, an empty string, is listed in section 5.4.

, href ( src). :

Hopefully, browsers will not have this problem in the future. Unfortunately, there is no such clause for <script src=""> and <link href="">. Maybe there is still time to make that adjustment to ensure browsers don't accidentally implement this behavior.

note: , :)

+1

Source: https://habr.com/ru/post/1768729/


All Articles