W3 Crash with <noscript> nested in DIV tag

My application works fine for me, but I would LOVE to be able to fully test it on W3.

My problem is pretty simple. I am using the Bing JS API to attach a Bing Map to a div tag. Inside this div tag, I have an element <noscript>that calls the static map provider MultiMap. IF javascript is disabled. The reason I decided to do this is because I don’t want to call the MultiMap API if I am not going to actually use it.

Is there an alternative way to do this so that I can be W3 HTML5 valid?

<div id='bingMap' class="largeMap">
    <noscript>
        <img src="http://developer.multimap.com/API/map/1.2/xxxxxxxxxxxxxxx?zoomFactor=11&amp;width=550&amp;height=400&amp;lat_1=51.18468&amp;lon_1=-114.497999&amp;lat_2=51.169858&amp;lon_2=-114.32549&amp;lat_3=51.083277&amp;lon_3=-114.203964&amp;lat_4=51.063097&amp;lon_4=-114.092031&amp;lat_5=50.939664&amp;lon_5=-113.973568" />
    </noscript>
</div>
+3
source share
4 answers

It is possible:

<html>
<body>
  <script type="text/javascript">
    document.write("<" + "!--");
  </script>
  <p>This will be commented out if scripting is supported.</p>
  <script type="text/javascript">
    document.write("-" + "->");
  </script>
</body>
</html>
+1

<img/> div, p -. <noscript> .

<div id='bingMap' class="largeMap">
    <noscript>
        <div>
            <img src="....." />
        </div>
    </noscript>
</div>
+1

I would suggest listing xmlns so that it doesn't interpret your code as XHTML5 (unlike HTML5), since XHTML5 is just a more strict version of HTML5 that prohibits many features. HTML5 still supports XHTML-style tags, so no loss.

The following will work:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>title</title>
  </head>
  <body>
    <div id="bingMap" class="largeMap">
      <noscript>
        <img alt="" src="http://developer.multimap.com/API/map/1.2/xxxxxxxxxxxxxxx?zoomFactor=11&amp;width=550&amp;height=400&amp;lat_1=51.18468&amp;lon_1=-114.497999&amp;lat_2=51.169858&amp;lon_2=-114.32549&amp;lat_3=51.083277&amp;lon_3=-114.203964&amp;lat_4=51.063097&amp;lon_4=-114.092031&amp;lat_5=50.939664&amp;lon_5=-113.973568" />
      </noscript>
    </div>
  </body>
</html>
+1
source

The following confirmations are verified for me at http://validator.w3.org/check

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC
  "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>title</title>
    <meta http-equiv="content-type" 
        content="text/html;charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
</head>
<body>

<div id='bingMap' class="largeMap">
    <noscript>
      <div>
        <img alt="" src="http://developer.multimap.com/API/map/1.2/xxxxxxxxxxxxxxx?zoomFactor=11&amp;width=550&amp;height=400&amp;lat_1=51.18468&amp;lon_1=-114.497999&amp;lat_2=51.169858&amp;lon_2=-114.32549&amp;lat_3=51.083277&amp;lon_3=-114.203964&amp;lat_4=51.063097&amp;lon_4=-114.092031&amp;lat_5=50.939664&amp;lon_5=-113.973568" />
      </div>
    </noscript>
</div>

</body>
</html>
0
source

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


All Articles