---
title: "请求服务器数据，解决IIE缓存问题"
author: "bence"
date: "2011-10-25T17:56:53Z"
tags: []
categories: ["Web前端"]
slug: "iie"
draft: false
lastmod: "2011-10-25T17:56:53Z"
id: 1214008
url: "https://bence.iteye.com/blog/1214008"
---

/**
		 * 加上随机数, 解决ie缓存的问题
		 * prefix 前缀，例如服务器地址
		 * endfix 后缀，如随机数，或者flash的版本号 
		 * */
		public static function randomUrl(url:String, prefix:String="", endfix:String=""):String{
			
			endfix = StringTools.equals(endfix, "") ? Math.random().toString() : endfix;
			
			return prefix + url + "?_key=" + endfix;
		}

/**
		 * 请求跨域策略文件 BASEURL 服务器地址
		 * */
		public static function loadPolicyFile(domain:String=null):void{
			if ( domain == null){
				domain = BASEURL + "ibp/crossdomain.jsp";
			}
			try{
				flash.system.Security.loadPolicyFile(domain);
			}catch(e:Error){
				trace(e.message);
			}
		}