<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: displayHTML &amp;lt;a href=&amp;quot;#id&amp;quot;&amp;gt; not working in Administration &amp; Architecture</title>
    <link>https://community.databricks.com/t5/administration-architecture/displayhtml-lt-a-href-quot-id-quot-gt-not-working/m-p/109516#M2962</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/31193"&gt;@invalidargument&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Currently, there is no direct support from the Databricks end to modify this behavior without using such a workaround. The &lt;CODE&gt;displayHTML&lt;/CODE&gt; function in Databricks renders HTML content within an iframe, and the injected JavaScript handles the link behavior within that iframe&lt;/P&gt;</description>
    <pubDate>Sat, 08 Feb 2025 22:28:56 GMT</pubDate>
    <dc:creator>Alberto_Umana</dc:creator>
    <dc:date>2025-02-08T22:28:56Z</dc:date>
    <item>
      <title>displayHTML &lt;a href="#id"&gt; not working</title>
      <link>https://community.databricks.com/t5/administration-architecture/displayhtml-lt-a-href-quot-id-quot-gt-not-working/m-p/109366#M2958</link>
      <description>&lt;P&gt;Many packages output a html-report, e.g. ydata-profiler. The report contains links to other parts of the report. But when the user clicks the links a new window is opened instead of scrolling to the correct section of the displayed html.&lt;/P&gt;&lt;P&gt;Could this be fixed from the databricks end somehow?&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;displayHTML("""
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Example HTML&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;h1 id="example"&amp;gt;Example Header&amp;lt;/h1&amp;gt;
    &amp;lt;p&amp;gt;This is an example paragraph with a &amp;lt;a href="#example"&amp;gt;link to the header&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
""")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a workaround to do inject javascript. Example with workaround:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;displayHTML("""
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Example HTML&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;h1 id="example"&amp;gt;Example Header&amp;lt;/h1&amp;gt;
    &amp;lt;p&amp;gt;This is an example paragraph with a &amp;lt;a href="#example"&amp;gt;link to the header&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;

    &amp;lt;script&amp;gt;
        document.querySelectorAll('a[href^="#"]').forEach(el =&amp;gt; {
            el.onclick = function(event) {
                event.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({ behavior: 'smooth' });
            };
        });
    &amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
""")&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 07 Feb 2025 09:01:47 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/displayhtml-lt-a-href-quot-id-quot-gt-not-working/m-p/109366#M2958</guid>
      <dc:creator>invalidargument</dc:creator>
      <dc:date>2025-02-07T09:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: displayHTML &lt;a href="#id"&gt; not working</title>
      <link>https://community.databricks.com/t5/administration-architecture/displayhtml-lt-a-href-quot-id-quot-gt-not-working/m-p/109516#M2962</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/31193"&gt;@invalidargument&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Currently, there is no direct support from the Databricks end to modify this behavior without using such a workaround. The &lt;CODE&gt;displayHTML&lt;/CODE&gt; function in Databricks renders HTML content within an iframe, and the injected JavaScript handles the link behavior within that iframe&lt;/P&gt;</description>
      <pubDate>Sat, 08 Feb 2025 22:28:56 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/displayhtml-lt-a-href-quot-id-quot-gt-not-working/m-p/109516#M2962</guid>
      <dc:creator>Alberto_Umana</dc:creator>
      <dc:date>2025-02-08T22:28:56Z</dc:date>
    </item>
  </channel>
</rss>

