none
javascript void(0) error?

    Question

  • I am trying to embed a google groups frame in an expression web page, and the code includes a javascript void(0) element, which is valid code, and works fine on the resulting page, but Web's display function chokes on it, saying:

          “could not open page :javascript:void(0).”

    The code is:

    <iframe id="forum_embed" src="javascript:void(0)" >

    </iframe>

    Sunday, February 19, 2012 4:55 PM

All replies

  • Well for one,  "javascript:void(0)" is not  a source that is going to fill an iframe,
    a source for an iframe is a link to a page within the site or a http:// url to another site's page.

    The way you have it "javascript:void(0)" is your source and "javascript:void(0)" = nothing, null, void.
    So EW is doing exactly what it should, which is nothing.


    Expression Web MVP


    • Edited by Steve Easton Sunday, February 19, 2012 5:51 PM
    • Proposed as answer by Classic Run Monday, February 20, 2012 1:51 AM
    Sunday, February 19, 2012 5:49 PM
  • What do you mean by "Web's display function"?  There isn't any such thing in EW.  Did you mean Design View of the page?  If so, well, EW doesn't run javascript.  That's for browsers to do, and EW's Design View is not a browser.  I have no idea how "javascript:void(0)" would create source for an iframe, but even if it could, it won't do it in EW since it can't run.  EW is expecting src to point to the page that is supposed to fill the iframe, and, rather obviously, it doesn't.


    • Edited by KathyW2 Sunday, February 19, 2012 9:42 PM
    Sunday, February 19, 2012 9:41 PM
  • Out of curiousity, I checked google on how to embed a group.  In addition to the iframe with the nonfunctional  javascript:void(0)" , you have script to actually populate the src parameter:

     "<iframe id="forum_embed"
     src="javascript:void(0)"
     scrolling="no"
     frameborder="0"
     width="900"
     height="700">
    </iframe>

    <script type="text/javascript">
     document.getElementById("forum_embed").src =
      "https://groups.google.com/forum/embed/?place=forum/forum-name" +
      "&showsearch=true&showpopout=true&parenturl=" +
      encodeURIComponent(window.location.href);
    </script>
    In the above example, you would want to change forum-name to the name of the group you want to pull into the iframe."

    So, my reply is on point.  The completely nonfunctional javascript:void(0)  is being replaced, using javascript, with the actual src.  Design View will not run the javascript to do that.  It tries to open page "javascript:void(0)", which is, of course, nonexistent.  Preview the page in a browser, and it will run the javascript and put the actual src in the iframe tag.

    By the way, that script to populate the src works if you change src="javascript:void(0)"  to src="" .  That "javascript:void(0)"  is, essentially, just a placeholder and means nothing in itself.

    Monday, February 20, 2012 1:37 AM
  • Yes, I did already have the full code as per the Google instructions, part of it got lost in my paste in to the message - sorry. So your note is that EW does not support JScript, so its display function will fail, just as it does. By "Web display works" I mean that any web browser does display correctly, only EW fails.To say that display view is not a browser is curious to me, I would (did) presume that it means "Display [like a browser]".

    I hadn't seen that EW dosn't support JS - that is the missing information, thanks.

    Might be good if EW would say that, instead of just "could not open page". And then it does not just miss that added iframe, but does not display any of the page - a bug in my opinion.

    I'm not sure what you mean by your proposed change to the Google code to add a placeholder, it works fine in FFox without any change.


    Guthrie

    Monday, February 20, 2012 4:03 AM
  • EW's Design Pane is a sketch pad, if you will. It doesn't display active content, but it does other things that browsers can't do and that web designers need (Visual Aids, including showing edges of elements, padding, margins, errors, and allowing you to work in the design pane and have the code automatically update, etc.). That's why it's so important to preview in the 4 or 5 major browsers.

    If EW did act as a browser, which one should it work like? That would be just as (if not more) counterproductive--lulling people into a false sense that all is fine without checking in other browsers.


    Comic Sans walks into a bar. The bartender says, "Get out! We don't serve your type."

    Monday, February 20, 2012 5:03 AM
  • " a bug in my opinion."

    No, it's not a bug at all.  EW Design View (NOT "Web display") is not a browser, and never said it was.  There's a reason that EW has Browser Preview tools: use them.  Not only is EW Design View not a browser, but it could not be: there are many browsers and they don't all display the same, and many have frequent updates, so which browser, which version, should it try to pretend to be?  And, Design View displays visual aids which take up their own space, etc..  Browsers run javsascript and do other things requiring interaction: EW Design View does not.  Use browser previews, in all the widely used browsers, to see how your page actually works.

    "I'm not sure what you mean by your proposed change to the Google code to add a placeholder, it works fine in FFox without any change."

    Re-read what I said.  I was pointing out that the "javascript:void(0)" meant nothing. It was just a text placeholder that would be replaced by the actual src address by the javascript that followed -- when run in a browser -- and a simple "" would work just as well as "javascript:void(0)".  Who knows why they used "javascript:void(0)"?


    • Edited by KathyW2 Monday, February 20, 2012 7:16 AM
    Monday, February 20, 2012 7:14 AM
  • Good, thanks- I was over expecting what EW Display mode did, and will use browser preview more. I still think it could display the rest of the page, missing what it could not render, instead of a blank page & error message instead.

    Guthrie

    Monday, February 20, 2012 1:05 PM
  • " I still think it could display the rest of the page, missing what it could not render, instead of a blank page & error message instead."

    It will.  If you have something else on the page besides that iframe, EW will display it, only displaying the missing src error inside the iframe. (Unless the other things on your page required browser interactivity, of course.  EW displays static content.)

    Monday, February 20, 2012 3:37 PM
  •  Thanks again! My mistake - because my display window was scrolled to that place of entry, all I was seeing was the grayed out error message space - but scrolling around I see that the rest is there. Thanks.


    Guthrie

    Monday, February 20, 2012 5:36 PM