小编Shu*_*ubh的帖子

如果iframe src无法加载,则会出现捕获错误.错误: - "拒绝在框架中显示'http://www.google.co.in/'.."

Knockout.js用来绑定iframe src标签(这可以根据用户进行配置).

现在,如果用户已配置http://www.google.com(我知道它不会在iframe中加载,这就是为什么我将其用于-ve场景)并且必须在IFrame中显示.但它会引发错误: -

拒绝在框架中显示" http://www.google.co.in/ ",因为它将"X-Frame-Options"设置为"SAMEORIGIN".

我为iframe提供了以下代码: -

<iframe class="iframe" id="iframe" data-bind="attr: {src: externalAppUrl, height: iframeheight}">
    <p>Hi, This website does not supports IFrame</p>
</iframe>
Run Code Online (Sandbox Code Playgroud)

我想要的是,如果网址无法加载.我想显示自定义消息. 我收到错误时控制台的屏幕截图 骗子在这里

现在,如果我使用onload和onerror作为: -

<iframe id="browse" style="width:100%;height:100%" onload="alert('Done')" onerror="alert('Failed')"></iframe>
Run Code Online (Sandbox Code Playgroud)

它可以正常加载w3schools.com,但不能与google.com.

其次: - 如果我把它作为一个功能,并尝试像我在我的小提琴,它不起作用.

<iframe id="browse" style="width:100%;height:100%" onload="load" onerror="error"></iframe>
Run Code Online (Sandbox Code Playgroud)

我不知道如何让它运行并捕获错误.

编辑: - 我已经看到如果iframe没有在stackoverflow中加载或加载问题,想要调用函数,但它显示可以在iframe中加载的网站的错误.

另外,我已经在加载事件上看了Stackoverflow iframe 谢谢!!

iframe jquery same-origin-policy knockout.js

68
推荐指数
5
解决办法
11万
查看次数

Microsoft Office Excel无法访问文件'c:\ inetpub\wwwroot\Timesheet\App_Data\Template.xlsx'

我的代码如下: -

Microsoft.Office.Interop.Excel.Application oXL = null;
Microsoft.Office.Interop.Excel.Sheets sheets;
Application excel = new Microsoft.Office.Interop.Excel.Application();


excel.Workbooks.Add(System.Reflection.Missing.Value);

/*
    * Here is the complete detail's about Workbook.Open()
    * 
    *  Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, 
    *  Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin,
    *  Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
    */

Workbook workbook = excel.Workbooks.Open(
    System.Web.HttpContext.Current.Server.MapPath("~/App_Data/Template.xlsx"),
    Missing.Value, true, Missing.Value, Missing.Value,
    Missing.Value, Missing.Value, Missing.Value,
    Missing.Value, Missing.Value, Missing.Value,
    Missing.Value, Missing.Value, Missing.Value,
    Missing.Value);
sheets = workbook.Worksheets; …
Run Code Online (Sandbox Code Playgroud)

c# excel export-to-excel excel-interop

44
推荐指数
3
解决办法
7万
查看次数

Javascript/jQuery:以CSV格式导出数据无法在IE中运行

我需要将表格中显示的数据导出为CSV格式.我已经尝试了很多东西,但无法让它适用于IE 9及更高版本.

我用我的代码创建了一个虚拟小提琴.

var data = [
    ["name1", "city1", "some other info"],
    ["name2", "city2", "more info"]
];//Some dummy data

var csv = ConvertToCSV(data);//Convert it to CSV format
var fileName = "test";//Name the file- which will be dynamic

if (navigator.userAgent.search("MSIE") >= 0) {
    //This peice of code is not working in IE, we will working on this
    //TODO
    var uriContent = "data:application/octet-stream;filename=" + fileName + '.csv' + "," + escape(csv);
    window.open(uriContent + fileName + '.csv');
} else {
    var …
Run Code Online (Sandbox Code Playgroud)

javascript export-to-csv

19
推荐指数
3
解决办法
3万
查看次数

无法加载文件或程序集'Microsoft.Web.Services3,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'

我正在使用ASP.NET MVC4(Visual Studio 2012),同时添加一个Controller我收到错误:

---------------------------
Microsoft Visual Studio
---------------------------
Could not load file or assembly 'Microsoft.Web.Services3, Version=3.0.0.0, 
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. 
The system cannot find the file specified.
---------------------------
OK   
---------------------------
Run Code Online (Sandbox Code Playgroud)

我没有得到可能出错的地方.我不知道可以提供哪些细节来解决问题.

asp.net-mvc

7
推荐指数
2
解决办法
1万
查看次数

仅为IE11加载css(样式表)

我想css只为IE11浏览器加载一个文件.我该怎么做?

我知道我可以使用conditional comments加载样式表的IE <= 9.但不适用于IE 10和11.

我可以谷歌找到一个替代方案如下:

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS styles go here */
}
Run Code Online (Sandbox Code Playgroud)

但是,它加载IE10和IE11浏览器.我想为IE11 加载样式表.可能吗?

谢谢

html css stylesheet conditional-comments internet-explorer-11

7
推荐指数
1
解决办法
1万
查看次数

在网站中显示Stackoverflow评级/信誉/徽章

在Stackoverfow获得声誉是一项艰苦的工作,如果我能在我的网站上获得声誉,我会感到高兴.可能吗?

stackoverflow是否会针对用户公开任何API?

[UPDATE]

当我输入时

http://api.stackoverflow.com/1.1/users/ {user-id} /

它给了我一个JSON数据,这对我来说似乎很好.可以这样使用它吗?

stackapps.com得到它回复Nathan Osman

谢谢.

stackexchange-api

6
推荐指数
1
解决办法
467
查看次数

对Twitter7的Twitter Bootstrap支持

我的应用程序是基于最新的Bootstrap Version 3.0.3.一切都运行良好Chrome and Mozilla.现在突然间,人们希望它能够得到支持IE7 and IE8.我已经尝试为IE7实现Bootstrap 3,但它没有帮助.一切仍然不合时宜.

在IE 7和IE8中,事情仍然存在.

我是否需要手动覆盖Bootstrap样式?我怀疑,bootstrap是如此可扩展和流行,必须做一些事情来支持IE7.

internet-explorer-7 twitter-bootstrap-3

6
推荐指数
1
解决办法
2万
查看次数

jenkins环境变量中的三元运算符

我需要在詹金斯的“环境”变量之一中进行三元运算。是否可以?例如Sample_Variable

pipeline {
    parameters {
        booleanParam (defaultValue: false,
            description: 'Check this if you want to do allow comments?',
            name: 'ALLOW_COMMENTS')

        string(name: 'ENTER_COMMENTS', defaultValue: '', description: 'Allow comments for this example..') 
    }

    environment {
        Sample_Variable: "${params.ALLOW_COMMENTS == true ? params.ENTER_COMMENTS:env.SOME_OTHER_ENV_VARIABLE}"
    }
}
Run Code Online (Sandbox Code Playgroud)

我在网上搜索但没有得到任何结果。我尝试了类似上面的方法,但它抛出错误:

Obtained Jenkinsfile from d1b56c1a276aa09424c88f25e052359f35f1a64c
Running in Durability level: MAX_SURVIVABILITY
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during class generation: Method code too large!

java.lang.RuntimeException: Method code too large!
    at groovyjarjarasm.asm.MethodWriter.a(Unknown Source)
    at groovyjarjarasm.asm.ClassWriter.toByteArray(Unknown Source)
    at org.codehaus.groovy.control.CompilationUnit$17.call(CompilationUnit.java:827)
    at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1065)
    at …
Run Code Online (Sandbox Code Playgroud)

jenkins

6
推荐指数
1
解决办法
5023
查看次数

使用泛型创建可重用方法

我不确定问题的标题,但这里是: -

我有我的代码: -

HttpClient client = new HttpClient();// Create a HttpClient
client.BaseAddress = new Uri("http://localhost:8081/api/Animals");//Set the Base Address

//eg:- methodToInvoke='GetAmimals'
//e.g:- input='Animal' class
HttpResponseMessage response = client.GetAsync('GetAllAnimals').Result;  // Blocking call!

if (response.IsSuccessStatusCode)
{
    XmlSerializer serializer = new XmlSerializer(typeof(Animal));//Animal is my Class (e.g)
    string data = response.Content.ReadAsStringAsync().Result;
    using (MemoryStream ms = new MemoryStream(UTF8Encoding.UTF8.GetBytes(data)))
    {
        var _response = (Animal)serializer.Deserialize(ms);
        return _response;
    }

}
Run Code Online (Sandbox Code Playgroud)

这非常有效,现在如果我需要为另一个班级做同样的事情Dog或者说Cat

我在做的是: -

HttpClient client = new HttpClient();// Create a HttpClient
    client.BaseAddress = new Uri("http://localhost:8081/api/Animals");//Set …
Run Code Online (Sandbox Code Playgroud)

c# generics

5
推荐指数
1
解决办法
902
查看次数

javascript:string.replace无法正常工作

我在替换javascript / jquery中的字符串时遇到了一个小问题。首先代码:

HTML:

<fieldset>
    <legend>Contact persons</legend>
    <div id="cm_contactPersons">
        <fieldset id="cm_%email%">
            <legend><span class="glyphicon glyphicon-circle-arrow-right"></span> %email%</legend>
            <div class="form-group">
                <label for="cm_%email_inputFirstname" class="col-sm-2 control-label">Firstname</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="cm_%email%_inputFirstname" value="%firstname%" placeholder="" required>
                </div>
            </div>
            <div class="form-group">
                <label for="cm_%email%_inputLastname" class="col-sm-2 control-label">Lastname</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="cm_%email%_inputLastname" value="%lastname%" placeholder="i. e. Max" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">Actions</label>
                <div class="col-sm-10">
                    <button type="button" class="btn btn-warning">Create new password</button>
                    <button type="button" class="btn btn-danger">Delete contact person</button>
                </div>
            </div>
        </fieldset>
    </div>
</fieldset>
Run Code Online (Sandbox Code Playgroud)

Javascript:

$(document).ready(function() {
    $('#cm_customerList').btsListFilter('#cm_customerSearchInput');
    var …
Run Code Online (Sandbox Code Playgroud)

javascript string jquery replace

5
推荐指数
1
解决办法
3440
查看次数