Answers

Question and Answer:

  Home  SWFObject

⟩ How to pass URIs or HTML code as a value using flashvars?

Special characters and the symbols = and & cannot directly be used inside flashvars values (the latter because they are used to stack the flashvars themselves).

You can workaround this issue by escaping these characters before passing them as flashvar values. An example:

encodeURIComponent("&trade") will become %26trade

The values will be available in your swf already unencoded, so no unescaping is needed inside your swf.

Note that encodeURIComponent is not available in all browsers, but is available in all of the common modern versions. If you need full backwards compatibility, you can use escape() instead, but note that escape() does not work well with double-byte characters (like Chinese).

You can also escape these characters manually by using:

%3D instead of =

%26 instead of &

 185 views

More Questions for you: