SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict bimalpoudel's Avatar
    Join Date
    Feb 2009
    Location
    Kathmandu, Nepal
    Posts
    279
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    firefox innerText?

    I have posted two issues here:

    1. Does div.innerText work in Firefox? It seems, not.
    IE and Opera support this.
    -------------

    2. In IE6, the HTTP_REFERER misses the GET parameter.
    player.swf?code=M3BtLmFsay9haWRlbS9zY29kdGgvOkY=

    I expected the page being called inside an embedded flash plaer (in fact, Google mp3 reader) does not have ?code=... in the referrer.

    [HTTP_REFERER] => http://localhost/media/player.swf?co...9zY29kdGgvOkY=
    It is seen in Opera and Firefox. While, IE sees:

    [HTTP_REFERER] => http://localhost/media/player.swf

    I just found these while I was trying to safeguard the mp3 files being played inside the Google reader.


    Code:
    var player = document.getElementById('player');
    
    var mp3_file = player.innerText;
    # NOT WORKING IN FIREFOX, but in Opera/IE. I need a text version only
    
    player.innerHTML = ''; # throw anything inside it
    
    var embed = document.createElement('embed');
    embed.setAttribute('type', 'application/x-shockwave-flash');
    embed.setAttribute('flashvars', 'audioUrl=mp3.php?file='+mp3_file);
    
    embed.setAttribute('src', 'player.swf?code='+mp3_file);
    # in IE6, this code is lost in referrer
    ...
    player.appendChild(embed); # install the player
    Last edited by bimalpoudel; Jan 27, 2011 at 14:09. Reason: code sample added
    Bimal Poudel @ Sanjaal Framework over Smarty Template Engine
    ASKING INTERESTING QUESTIONS ON SITEPOINT FOURM

    Hire for coding support - PHP/MySQL

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,861
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by bimalpoudel View Post
    1. Does div.innerText work in Firefox? It seems, not.
    IE and Opera support this.
    innerText is an IE proprietary property. Opera copies many of the IE proprietary codes - other browsers do not usually do so. The only IE proprietary property similar to innerText that was considered useful enough for all browsers to adopt it as a defacto standard is innerHTML. Simply substitute innerHTML for innerText and it should then work for all browsers.


    embed is also a proprietary tag (admittedly one supported by most browsers). You would probably get it to work better if you instead used the standard object tag that is intended for the purpose. See http://www.felgall.com/flash.htm for two ways to use object tags to embed flash depending on whether or not you need to support antiquated flash versions in IE6.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Addict bimalpoudel's Avatar
    Join Date
    Feb 2009
    Location
    Kathmandu, Nepal
    Posts
    279
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. I will rewrite the codes for FF and Opera.
    I don't really care if IE cannot render my pages correctly.

    If I modify the original HTML, I can read the values inside the div correctly.

    Code:
    <div id="player">
    <!-- flash player goes here -->
    <span style="visibility:hidden">M3BtLmFsay9haWRlbS9zY29kdGgvOkY=</span>
    <!-- flash player ends here -->
    </div>
    The real code here is inside the span tag. I will write as:
    <span id='..'>...code...</span> inside the #player div.

    This will solve. Thanks Stephen.
    Bimal Poudel @ Sanjaal Framework over Smarty Template Engine
    ASKING INTERESTING QUESTIONS ON SITEPOINT FOURM

    Hire for coding support - PHP/MySQL

  4. #4
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    element.textContent is the non-ie element.innerText

    var text=element.textContent || element.innerText || '';


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •