问题
All my sites need to be search engine friendly - ie readable by search engines. However, I kind of like flash and would like to integrate it in a friendly way.
I have the option of swfobject, which allows proper page names and serves different pages to the user vs search engine.
However, I am wondering why there would be a need to use swfobject. For instance, I could just use a normal php cms page and insert flash elements into it. When the page is called by a search engine, just serve the pure html, whereas a user would get the flash.
I'd really appreciate to find out other points of view on this subject and the benefits of the different approaches.
Many thanks
K
回答1:
First of all, the html code you have to write to embed an swf file is different for some browsers.
Firefox, Chrome, .. use <object>
tags while IE uses <embed>
tags.
SWFObject is a javascript 'library' (kinda silly since it is only one file :P) that can inject the proper html tags directly into the DOM tree, and handles those browser differences for you.
Furthermore there were some security concerns for flash cross site scriptings attacks in the past.
I know for a fact that in older Flex Builder versions there were problems with the generated html-templates which could potentially cause major security issues.
Nowadays in newer versions of Flash Builder, Adobe uses SWFObject by default to create html wrapper files.
So, to answer your question:
Is it really necessary? No, it's not if you know what you are doing. Is it convenient and an Adobe standard, yes it is.
Cheers
来源:https://stackoverflow.com/questions/6213930/swf-object-why-should-i-use-it