Firefox innerText?

I have posted two issues here:

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

  1. 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?code=M3BtLmFsay9haWRlbS9zY29kdGgvOkY=
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.


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?[b]code[/b]='+mp3_file);
# in [b]IE6[/b], this code is lost in referrer
...
player.appendChild(embed); # install the player

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.

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.


<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.

element.textContent is the non-ie element.innerText

var text=element.textContent || element.innerText || ‘’;