Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of perfect cross-domain access of Flash

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

First of all, you have to determine the following points, otherwise it may not be possible to achieve:

Which domain do you want to cross, you must be able to manage the files on that domain, because here you want to put a pass file.

2, if your Flash only SWF, it may not be able to achieve, because sometimes, Flash AS, to add a sentence.

If you are cross-domain transfer pictures, videos and the like, you can use the method of access files. To create a common file, save the following code as crossdomain.xml and place it under the root directory of the target site to be cross-domain. That is to say, your FLASH is at www.example.com. If you want to access the resources on b.com, you have to make sure that http://b.com/crossdomain.xml can be accessed. a.com

The above is to allow all website calls, if you want to restrict a website can use the following:

In the above code, www.mayax.net is allowed to make cross-domain calls. But bbs.mayax.net doesn't work; at the same time, vkcms.com is allowed to cross domains, bbs.vkcms.com is also available, vkflash.vkcms.com is also available! However, others such as zhi.in and www.zhoujingsong.com cannot be accessed across domains.

If you cross-domain access JS, or send data to cross-domain JS, then you have to do the following on the basis of the pass file.

If your FLASH file wants to pass data to JS file, call Flash SWF file HTML code, add this line parameter:

reference

Parameter Description:

always allows script operations to be executed at any time;

Never prohibits all scripts from performing actions.

If your FLASH is to read the data sent by JS, then in the AS code of FLASH, add:

System.security.allowDomain("*");

There is also a common problem, prompt import flash.display.BitmapData invalid, add the following line of code in AS can be:

System.security.loadPolicyFile(http://yoursite.com/crossdomain.xml);

The content of crossdomain.xml is the same as above.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report