Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Safari (Mac) + innerHTML

Safari (Mac) + innerHTML

Scheduled Pinned Locked Moved Web Development
htmlhelpquestionlearning
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dmitry Khudorozhkov
    wrote on last edited by
    #1

    Hi everyone! I have a html page with an IFrame; and the following code:

    var doc = document.getElementById("iframe_id").contentDocument;
    doc.body.innerHTML = htmlCode;

    This code is run in body's onload handler. 'htmlCode' contains some (very simple) html (it is a string, of course). I was able to test this code only in Safari 1.3 (Mac), and it didn't work :( BUT: I need to test it in a Safari 2.0.4. Unfortunatelly, I don't have access to it. Anyone (with Mac) can tell me if it will work? And why the above code didn't work with Safari 1.3? Is it possible to fix it? Thank you very much in advance! P.S. I understand it is a MS-centric forum, but... I do hope.

    ------------------------- Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).

    G 1 Reply Last reply
    0
    • D Dmitry Khudorozhkov

      Hi everyone! I have a html page with an IFrame; and the following code:

      var doc = document.getElementById("iframe_id").contentDocument;
      doc.body.innerHTML = htmlCode;

      This code is run in body's onload handler. 'htmlCode' contains some (very simple) html (it is a string, of course). I was able to test this code only in Safari 1.3 (Mac), and it didn't work :( BUT: I need to test it in a Safari 2.0.4. Unfortunatelly, I don't have access to it. Anyone (with Mac) can tell me if it will work? And why the above code didn't work with Safari 1.3? Is it possible to fix it? Thank you very much in advance! P.S. I understand it is a MS-centric forum, but... I do hope.

      ------------------------- Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      You might have better luck with writing the entire page into the iframe. Example:

      var doc = document.getElementById("iframe_id").contentDocument;
      doc.open();
      doc.write('<html><head><title></title></head><body>'+htmlCode+'</body></html>');
      doc.close();

      --- single minded; short sighted; long gone;

      D 1 Reply Last reply
      0
      • G Guffa

        You might have better luck with writing the entire page into the iframe. Example:

        var doc = document.getElementById("iframe_id").contentDocument;
        doc.open();
        doc.write('<html><head><title></title></head><body>'+htmlCode+'</body></html>');
        doc.close();

        --- single minded; short sighted; long gone;

        D Offline
        D Offline
        Dmitry Khudorozhkov
        wrote on last edited by
        #3

        Ok, this variant does work :) But what to do with the original code? Does it work in the Safari 2?... Thanks anyway.

        ------------------------- Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).

        G K 2 Replies Last reply
        0
        • D Dmitry Khudorozhkov

          Ok, this variant does work :) But what to do with the original code? Does it work in the Safari 2?... Thanks anyway.

          ------------------------- Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          Dmitry Khudorozhkov wrote:

          But what to do with the original code? Does it work in the Safari 2?...

          I don't know. I don't have a mac.

          --- single minded; short sighted; long gone;

          1 Reply Last reply
          0
          • D Dmitry Khudorozhkov

            Ok, this variant does work :) But what to do with the original code? Does it work in the Safari 2?... Thanks anyway.

            ------------------------- Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).

            K Offline
            K Offline
            kuyak2000
            wrote on last edited by
            #5

            Dmitry Khudorozhkov wrote:

            But what to do with the original code? Does it work in the Safari 2?...

            That code does work on Safari for Windows, although it's a little bit different in size and exact location. Eriawan :)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups