locked
Loading SVG inside IFrame in Html 4.0 RRS feed

  • Question

  • Hi,

     

               I have aspx page the document type is HTML 4.0 is it possible to load svg inside iframe without changing to HTML 5.0

     

    Regards,

    Shijith

    <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <%--<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 5.0 Transitional//EN" >--%>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Sample</title>
    </head>
    <body>
    <form id="form1" runat="server" >
        <iframe  src='SvgViewer.htm'></iframe>
    </form>
    </body>
    </html>

     

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
    </head>
    <body>
    <embed src="sample.svg" style='width:100%; height:100%;' type='image/svg+xml' wmode='transparent'/>
    </body>
    </html>

     

    <?xml version="1.0" standalone="no"?>
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
    <svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
      <rect width="300" height="100"  style="fill:rgb(0,0,255);stroke-width:1;stroke:rgb(0,0,0)"/>
    </svg>

    Monday, February 14, 2011 11:19 AM

All replies

  • hi Shijith M.C,

    thanks for posting!

    it will work.

    you can also load svg file in iframe directly. load sample.svg in aspx page  as follow:

    <form id="form1" runat="server" >
        <iframe  src='sample.svg' width="100%" height="100%"></iframe>
    </form>

    hope this helps, thanks!


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com
    Microsoft One Code Framework
    • Marked as answer by Yanping Wang Friday, February 25, 2011 6:12 AM
    • Unmarked as answer by Shijith M.C Tuesday, March 8, 2011 10:57 AM
    Monday, February 21, 2011 7:56 AM
  • Your DTD has no publicId... MS browsers think this is a Quirks document.
    Rob^_^
    • Marked as answer by Yanping Wang Friday, February 25, 2011 6:12 AM
    • Unmarked as answer by Shijith M.C Tuesday, March 8, 2011 10:57 AM
    Monday, February 21, 2011 9:15 AM
  • Thanks for your reply... I'm getting this error

     

    The XML page cannot be displayed Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later. Unspecified error Error processing resource 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'. 

    This error is not displayed in HTML 5.0 doctype

    I want to keep Html 4.0 document type in my parent page and load svg inside iframe or a page which gets called from Iframe.. Is there anyway to override the document type in iframe.. force iframe to use Html 5.0 doctype.

     

    Regards,

    Shijith

    Tuesday, March 8, 2011 11:04 AM