我有一个 iframe,我尝试使用 ajax 添加它的标题,但它不起作用。我们尝试在 iframe 中放入的页面中的 js 方法会导致问题:
方法未定义并导致空白页。我们尝试包含的页面是 asp.net(来自 abbyy 的 flexicapture)
$.ajax({
type: "GET",
url: "http://172.20.30.8/FlexiCapture12",
contentType: "application/json",
beforeSend: function(xhr, settings){
xhr.setRequestHeader("some_custom_header", "foo");},
success: function(data){
console.log(data);
$("#myFrame").attr('src',"data:text/html;charset=utf-8," + escape(data));
}
});
任何想法 ?
这里的错误:未捕获的ReferenceError:未定义Ui_Model
使用简单的 iframe 标签,它可以工作,但我们需要将 header 或 cookie 注入
PS:这是内容iframe
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>UI</title>
<link rel="shortcut icon"
href="/FlexiCapture12/Login/Content/images/TabIcon.ico" />
<link href="/FlexiCapture12/Login/WebCommon/WebCommonCss?
v=QrXq6ljGiWHstlXVpAXLMNzZ6cyaoydsT5gsI629ER01" rel="stylesheet"/>
<link href="/FlexiCapture12/Login/Content/css?
v=CcVW8jp8169r4jTB7Wkw2N1TrY1RMIrcOXVeOL3LaMo1" rel="stylesheet"/>
<link href="/FlexiCapture12/Login/Content/general/css?
v=I0nviCV6U1d3tl9uZqDz0tVCXIeZOrYHEACjHLKxhVA1" rel="stylesheet"/>
<script src="/FlexiCapture12/Login/WebCommonExternal?
v=hK5886_opsMQ3AxjzkVhwRtKuughLHC1pqmGAGdDaZw1"></script>
<script src="/FlexiCapture12/Login/WebCommon?v=yfkjMl06jF6DhlPjz-
6CxMqczHjqZIjKpnCyLxwAy8s1"></script>
<script src="/FlexiCapture12/Login/bundles/modernizr?
v=inCVuEFe6J4Q07A0AcRsbJic_UE5MwpRMNGcOtk94TE1"></script>
<script src="/FlexiCapture12/Login/bundles/signaljs?v="></script>
<script src="/FlexiCapture12/Login/bundles/moment?
v=2v8Tw1bW5jhBpfywRx36sJR1xZCerziad7XUy33UKio1"></script>
<script type="text/javascript"
src="/FlexiCapture12/Login/Content/JsEnvironment"></script>
<script src="/FlexiCapture12/Login/bundles/standart?
v=m5NAFE0GQZHGrd4XGUYauBkrXpxuQbhKpEOsnNk2C8k1"></script>
<script
type="text/javascript">Ui_Model({"PageId":"Login","InstallationLanguage":"en-
US","SupportedLanguages":[{"FineObjectsCode":0,"Id":"en-US","Name":"English
(United States)"},{"FineObjectsCode":-1,"Id":"en-GB","Name":"English (United
Kingdom)"},{"FineObjectsCode":1,"Id":"ru","Name":"Русский"},
{"FineObjectsCode":2,"Id":"de","Name":"Deutsch"},
{"FineObjectsCode":3,"Id":"fr","Name":"Français"},
{"FineObjectsCode":5,"Id":"es","Name":"Español"},
{"FineObjectsCode":26,"Id":"ja","Name":"日本
"}],"CurrentUserInfo":null,"PermissionRequests":null,"UserPermissions":0,"Avai libleStations":null,"NoDatabase":false,"DoTenantsExist":false});