I am making a data URL generator, and the last part of this project is the "open in new tab" button. But when I clicked the "open in new tab" button, it opens about:blank. I looked in the inspect panel, and an error was thrown.
Not allowed to navigate top frame to data URL: <data url here>
Here is my open in new tab code:
let dataurl = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iNTAwIiBoZWlnaHQ9IjUwMCI+CjxjaXJjbGUgY3g9IjI1MCIgY3k9IjI1MCIgcj0iMjEwIiBmaWxsPSIjZmZmIiBzdHJva2U9IiMwMDAiIHN0cm9rZS13aWR0aD0iOCIvPgo8L3N2Zz4K"; // Sample url
document.querySelector("#newtab").addEventListener("click", function () {
  const newWindow = window.open(dataurl);
});:root {
  --theme-color-light: #3d5afe;
  --theme-color: #364fe1;
  --theme-color-dark: #2039c8;
  font-family: sans-serif; 
}
button {
  background-color: var(--theme-color-light);
  border: none;
  color: white;
  padding: 5px 7px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
button:hover {
  background-color: var(--theme-color);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}
button:active {
  background-color: var(--theme-color-dark);
}
span {
  margin-left: 5px;
}<button id="newtab">
  <svg
    width="24"
    height="24"
    viewBox="0 0 24 24"
    fill="none"
    stroke="white"
    stroke-width="2"
    stroke-linecap="round"
    stroke-linejoin="round"
  >
    <path d="M14 6L6 6L6 18L18 18 L18 10"></path>
    <path d="M12 12L22 2L22 10M22 2L14 2"></path>
  </svg>
  <span>Open in new tab</span>
</button>Although the above snippet may not open anything at all, that's just because the snippet is in an iframe. In real-life, it just opens about:blank and throws the error in the about:blank URL. So my question is, what can I do to avoid this data URL not allowed error?. Other answers like this one to this question put the data URL in an iframe, but the URL just stays on about:blank.
Note: I am using Microsft edge 103
 
    