简体   繁体   中英

Can I inject javascript code from the address bar into a flash video

借助常规HTML,只需在地址栏中输入网址并按键盘上的Enter键,就可以更改页面的外观并使用javascript制作新的Cookie。但是Flash视频呢?有没有一种方法可以对视频进行一些操作在地址栏中使用javascript的页面?

Unless I have misunderstood your question, I would advise that the last thing you would want to do is allow Javascript entered into your address bar to have any control over your page content.

Doing so allows users to abuse your pages and is also a security threat.

If you can avoid passing Javascript via the address bar, it is entirely possible for Javascript to 'control' flash objects on the page. Check this out:

http://livedocs.adobe.com/flex/3/langref/flash/external/ExternalInterface.html

And also this thread too:

Controlling a Flash Player using JavaScript

You don't need that.
AS3 has the ExternalInterface class that deals with calling JavaScript functions from Flash.
You can both call JavaScript functions and get results returned by JavaScript functions directly from Flash.

All you need is read this:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html

Added after comments:
User is asking if JavaScript placed in address bar can "mess with swf" file. JavaScript can only mess with SWF execution of its AS code if it contains callbacks that get data from JavaScript which are not properly sanitized. JavaScript directly in address bar is less of a wary because using various addons, software etc (Firebug, Dragonfly) you can write as much JavaScript as you want and execute it as if it was part of that site (client side execution).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM