本篇文章给大家谈谈尝试设置Cookie时出现未捕获的错误:SECURITY_ERR:DOM异常18,以及尝试设置ip地址或站名称时出错的知识点,同时本文还将给你拓展Angularjs未捕获的错误:迁移
本篇文章给大家谈谈尝试设置Cookie时出现未捕获的错误:SECURITY_ERR:DOM异常18,以及尝试设置ip地址或站名称时出错的知识点,同时本文还将给你拓展Angularjs未捕获的错误:迁移到V1.3时出现[$ injector:modulerr]、AngularJS:未捕获的错误:[$ injector:modulerr]无法实例化模块?、asp.net-mvc – SessionSecurityTokenHandler尝试使用DPAPI解密RSA加密cookie中的SessionSecurityToken;为什么?、Cordova ios SecurityError上的Ajax调用:DOM异常18等相关知识,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:- 尝试设置Cookie时出现未捕获的错误:SECURITY_ERR:DOM异常18(尝试设置ip地址或站名称时出错)
- Angularjs未捕获的错误:迁移到V1.3时出现[$ injector:modulerr]
- AngularJS:未捕获的错误:[$ injector:modulerr]无法实例化模块?
- asp.net-mvc – SessionSecurityTokenHandler尝试使用DPAPI解密RSA加密cookie中的SessionSecurityToken;为什么?
- Cordova ios SecurityError上的Ajax调用:DOM异常18
尝试设置Cookie时出现未捕获的错误:SECURITY_ERR:DOM异常18(尝试设置ip地址或站名称时出错)
当我尝试使用此jQuery插件设置Cookie时,在Chrome开发人员工具窗口中出现以下错误:
未捕获的错误:SECURITY_ERR:DOM异常18
此错误是什么意思,我该如何解决?使用此
jQuery插件时出现相同的错误。
答案1
小编典典您最有可能通过file://
URI方案在本地文件上使用此文件,该文件无法设置cookie。将其放在本地服务器上,以便可以使用http://localhost
。
Angularjs未捕获的错误:迁移到V1.3时出现[$ injector:modulerr]
我正在学习Angular.js,但无法弄清楚此简单代码有什么问题。看起来不错,但出现以下错误。
**Error**: Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.3.14/$injector/modulerr?p0=app&p1=Error%3A%20…gleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14%2Fangular.min.js%3A17%3A381)
在添加之前(我只是保持原样),它给了我以下错误。这是为什么?ng-app= **"app"**``ng-app
Error: [ng:areq] http://errors.angularjs.org/1.3.14/ng/areq?p0=Ctrl&p1=not%20a%20function%2C%20got%20undefined at Error (native) at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:6:417 at Sb (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:19:510) at tb (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:20:78) at $get (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:75:331) at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:57:65 at s (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:7:408) at A (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:56:443) at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:51:299) at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:51:316)<!doctype html> <html ng-app="app"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> </head> <body> <div ng-controller="Ctrl"> <input ng-model="name"> <h1>{{name}}</h1> <h2>{{age}}</h2> </div> <script> var Ctrl = function($scope) { $scope.age = 24; }; </script> </body> </html>
答案1
小编典典禁用AngularJS 1.3版全局控制器功能声明后
您需要首先创建一个AngularJS模块,然后将所有组件附加到该特定模块。
码
function Ctrl($scope) { $scope.age = 24;}angular.module(''app'', []) .controller(''Ctrl'', [''$scope'', Ctrl]);
专门针对您的情况,AngularJS存在一些问题 1.3.14
(将其降级为 1.3.13
正常)。虽然我希望您使用angular 1.2.27 AngularJS 1.6.X,这是AngularJS的更稳定版本和最新版本。
更新:
您可以通过在其中允许全局控制器声明来将当前代码设置为工作状态angular.config
。但这不是运行角度应用程序的正确方法。
function Ctrl($scope) { $scope.age = 24;}angular.module(''app'', []) .config([''$controllerProvider'', function ($controllerProvider) { $controllerProvider.allowGlobals(); } ]);
AngularJS:未捕获的错误:[$ injector:modulerr]无法实例化模块?
我是AngularJS的新手,并且通过一些文档和教程来学习。我的问题是参考Egghead的视频系列,尤其是该视频,该视频演示了如何组合基本的搜索过滤器。我想在一个真正的应用中使用此应用,我正在为一家从事蜡烛业务的小朋友打造,但是当我将其修改为她的蜡烛而不是复仇者联盟的演员(如视频中的演示)时,出现此错误:
未捕获的错误:[$ injector:modulerr]由于以下原因,无法实例化模块myApp:
错误:[$ injector:nomod]模块’myApp’不可用! 您可能拼错了模块名称,或者忘记了加载它。如果注册模块,请确保指定…
我将视频演示中的精确版本(数组中只有3个演员)复制到jsfiddle中,发现它仍然产生相同的错误。(作为参考,Egghead演示在这里:http : //www.thinkster.io/angularjs/ET1iee6rnm/angularjs-
ngfilter)。到目前为止,我已经在该网站上阅读了至少六个类似的问题,并尝试了所有提供的解决方案,但是没有一个解决这个错误或导致“复仇者联盟”搜索-
在视频演示中运行良好-可以正常运行正确地。
HTML:
<div ng-app="myApp"> <div ng-controller="AvengersCtrl"> <input type="text" ng-model="search.$" /> <table> <tr ng-repeat="actor in avengers.cast | filter:search"> <td>{{actor.name}}</td> <td>{{actor.character}}</td> </tr> </table> </div></div>
Javascript:
var myApp = angular.module(''myApp'', []);myApp.factory(''Avengers'', function () { var Avengers = {}; Avengers.cast = [ { name: "Robert Downey Jr.", character: "Tony Stark / Iron Man" }, { name: "Chris Evans", character: "Steve Rogers / Captain America" }, { name: "Mark Buffalo", character: "Bruce Banner / The Hulk" } ]; return Avengers;})function AvengersCtrl($scope, Avengers) { $scope.avengers = Avengers;}
简而言之,有人可以提供一种可以解决该错误的解决方案,并且可以用简单的英语(不是博士级别的“ Angular
Obscurese”)进行解释(简而言之)是什么原因以及需要做什么的。做了避免吗?
编辑:抱歉,但是上面从教程中引用的jsfiddle链接不再有效。我已经删除了断开的链接。提到的教程仍然可供查看。
答案1
小编典典尝试在小提琴中使用 无包裹-头戴 或 无包裹-身体 :
工作提琴:http :
//jsfiddle.net/Q5hd6/
说明 :
DOM 完全加载后, Angular开始编译DOM
。您注册要运行的代码onLoad
(小提琴中的onload选项)=>现在注册myApp
模块已为时已晚,因为angular开始编译DOM,而angular看到没有命名的模块myApp
并抛出异常。
通过使用 No Wrap-In Head ,您的代码如下所示:
<head> <script type=''text/javascript'' src=''//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.js''></script> <script type=''text/javascript''> //Your script. </script></head>
您的脚本有机会在angular开始编译DOM之前运行,并且angular开始编译DOM myApp
时已经创建了模块。
asp.net-mvc – SessionSecurityTokenHandler尝试使用DPAPI解密RSA加密cookie中的SessionSecurityToken;为什么?
FederatedAuthentication.ServiceConfigurationCreated += (sender,args) => { var sessionTransforms = new List<CookieTransform>(new CookieTransform[] { new DeflateCookieTransform(),new RSAEncryptionCookieTransform(args.ServiceConfiguration.ServiceCertificate),new RsaSignatureCookieTransform(args.ServiceConfiguration.ServiceCertificate) }); var sessionHandler = new SessionSecurityTokenHandler(sessionTransforms.AsReadOnly()); args.ServiceConfiguration.SecurityTokenHandlers.AddOrReplace(sessionHandler); };
使用此配置,我们能够从身份提供商处接收令牌,并发出使用这些转换加密的安全cookie.在Azure模拟器中运行,一切都按预期工作.但是,在Azure环境中,我们间歇性地在浏览器中看到以下错误:
Key not valid for use in specified state. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Security.Cryptography.CryptographicException: Key not valid for use in specified state. Source Error: An unhandled exception was generated during the execution of the current web request. information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [CryptographicException: Key not valid for use in specified state. ] System.Security.Cryptography.ProtectedData.Unprotect(Byte[] encryptedData,Byte[] optionalEntropy,DataProtectionScope scope) +577 Microsoft.IdentityModel.Web.ProtectedDataCookieTransform.Decode(Byte[] encoded) +80 [InvalidOperationException: ID1073: A CryptographicException occurred when attempting to decrypt the cookie using the ProtectedData API (see inner exception for details). If you are using IIS 7.5,this Could be due to the loadUserProfile setting on the Application Pool being set to false. ] Microsoft.IdentityModel.Web.ProtectedDataCookieTransform.Decode(Byte[] encoded) +433 Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ApplyTransforms(Byte[] cookie,Boolean outbound) +189 Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(XmlReader reader,SecurityTokenResolver tokenResolver) +862 Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(Byte[] token,SecurityTokenResolver tokenResolver) +109 Microsoft.IdentityModel.Web.SessionAuthenticationModule.ReadSessionTokenFromCookie(Byte[] sessionCookie) +356 Microsoft.IdentityModel.Web.SessionAuthenticationModule.TryReadSessionTokenFromCookie(SessionSecurityToken& sessionToken) +123 Microsoft.IdentityModel.Web.SessionAuthenticationModule.OnAuthenticateRequest(Object sender,EventArgs eventArgs) +61 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80 System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously) +270
这似乎表明SessionSecurityTokenHandler正在尝试使用DPAPI解密cookie,但为什么呢?我没有配置它使用上面的RSA吗?
解决方法
MachineKeySessionSecurityTokenHandler
在Web场中对会话令牌进行签名和加密.
要使用它,您需要删除默认的SessionSecurityTokenHandler并在Web.config中添加MachineKeySessionSecurityTokenHandler:
<system.identityModel> <identityConfiguration> <securityTokenHandlers> <remove type="System.IdentityModel.Tokens.SessionSecurityTokenHandler,System.IdentityModel,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089" /> <add type="System.IdentityModel.Services.Tokens.MachineKeySessionSecurityTokenHandler,System.IdentityModel.Services,PublicKeyToken=b77a5c561934e089" /> </securityTokenHandlers> </identityConfiguration> </system.identityModel>
MachineKeySessionSecurityTokenHandler使用在Web.config中配置的机器密钥,因此您还需要添加它:
<system.web> <machineKey validationKey="..." decryptionKey="..." validation="SHA1" decryption="AES" /> </system.web>
请参阅BrainThud的这个问题
Cordova ios SecurityError上的Ajax调用:DOM异常18
嗨,我正在通过Cordova(5.1.1)/ Phonegap构建iOS应用程序,但有一个我无法解决的问题。
一个基本的Ajax
电话抛出一个问题,SecurityError: DOM Exception18
我尝试了所有有关白名单的技巧,但现在我迷路了。有谁可以帮助您?谢谢。
准备好设备后,我会执行以下操作:
var getUrl = ''http://shopplo.com/api/posts/radius/''+app.lat_min+''x''+app.lat_max+''x''+app.lng_min+''x''+app.lng_max+''''; //console.log(getUrl); var getPosts = $.ajax({ method: ''GET'', url: getUrl, dataType: ''JSON'' }) .done(function(e) { console.log( e ); }) .fail(function(e) { //console.log( "error"); $.each(e, function(key, element) { console.log(''key: '' + key + ''\n'' + ''value: '' + element); }); }) .always(function() { console.log( "complete" ); });
getUrl是:http
:
//shopplo.com/api/posts/radius/37.11032230061141x73.11032230061141x-20.572796183027627x42.36447502674581
我得到:
2015-07-20 01:12:55.981 ShopploLight[779:568632] key: responseJSON :: value: undefined2015-07-20 01:12:55.983 ShopploLight[779:568632] key: status :: value: 02015-07-20 01:12:55.983 ShopploLight[779:568632] key: statusText :: value: Error: SecurityError: DOM Exception 182015-07-20 01:12:55.984 ShopploLight[779:568632] complete
答案1
小编典典检查您的元标记。默认情况下,它使用:
<meta http-equiv="Content-Security-Policy" content="default-src ''self'' data: gap: https://ssl.gstatic.com ''unsafe-eval''; style-src ''self'' ''unsafe-inline''; media-src *">
使用下面的代码启用所有请求
<!-- Enable all requests, inline styles, and eval() --><meta http-equiv="Content-Security-Policy" content="default-src *; style-src ''self'' ''unsafe-inline''; script-src: ''self'' ''unsafe-inline'' ''unsafe-eval''">
今天关于尝试设置Cookie时出现未捕获的错误:SECURITY_ERR:DOM异常18和尝试设置ip地址或站名称时出错的讲解已经结束,谢谢您的阅读,如果想了解更多关于Angularjs未捕获的错误:迁移到V1.3时出现[$ injector:modulerr]、AngularJS:未捕获的错误:[$ injector:modulerr]无法实例化模块?、asp.net-mvc – SessionSecurityTokenHandler尝试使用DPAPI解密RSA加密cookie中的SessionSecurityToken;为什么?、Cordova ios SecurityError上的Ajax调用:DOM异常18的相关知识,请在本站搜索。
本文标签: