0

I gave the html page to a new open tab in the web as content. In a windows computer and android phones it works: it opens a blank page and add the html content in there. But when it is opened in safari from iPhone I get this error because the frog object is null.

How can I open a new tab in the safari from iPhone? Here is the code I wrote:

 const frog = window.open();
              frog.document.write(res);
              frog.document.close();
FaFa
  • 358
  • 2
  • 16
  • the error comes from the build version. The frog element is null, so frog.document it throws that error. @Teemu I updated the answer – FaFa Aug 07 '23 at 10:31
  • You could try to wait for the window to load before accessing it. – Teemu Aug 07 '23 at 10:33
  • This may be relevant: https://stackoverflow.com/questions/20696041/window-openurl-blank-not-working-on-imac-safari – DallogFheir Aug 07 '23 at 10:35
  • I have tried @DallogFheir . are there other ways more up to date? – FaFa Aug 07 '23 at 13:12

0 Answers0