javascript - Error: Could not complete the operation due to error 8150002e
问题描述
I am working on a Outlook VSTO add-in, in which I am using 'System.Windows.Forms.WebBrowser' to display the add-in functionality.
One functional requirement is to have oauth connection to cloud accounts (like OneDrive, Dropbox). When user clicks a button (e.g. 'Connect OneDrive'), we call 'window.open' in JavaScript code (ES6) with the oauth-url.
The issue which I am facing is, if user doesn't enter any credentials and close the window, and then again try to connect the cloud account (by clicking the 'Connect OneDrive'), I am getting an exception (Error: Could not complete the operation due to error 8150002e.).
I couldn't find any information about the error code '8150002e' on web.
This exception is not always present but comes around 50% of the times.
Any help would be appreciated in this.
what I have tried:
changing the windowName param every time window.open is called
having global var for window Object.
Using _blank parameter to open a new window every time.
After 5-6 times, the error comes up, after 5-6 times error goes away and auth window start coming up like before.
- Opening a simple static HTML page in 'window.open' to verify if the issue has something to do with HTML page. The above issue is still present.
- Resetting the System.Windows.Forms.WebBrowser programmatically.
- Removing the cookies.
- Instead of calling window.open from JavaScript code, we call VSTO code to open the browser window, the error is still there.
Edit: Created a minimal viable example at https://github.com/vinay-x/SampleAddin
Code related to the issue:
- SDXOLForm1.cs (navigates the browser to SamplePage.HTML hosted on localhost:8001) SamplePage.HTML (contains a button, which calls window.open function).
The sample application has a windows form which contains a webBrowser control, which navigates to a simple HTML page which contains a button.
解决方案
不得不处理一些 IE11 的东西,我遇到了这个问题。我发现解决此问题的解决方案是在调用 window.open 之前将 window 变量设置为 null。
所以对于你的例子,你有这个:
function myFunction() {
window.open("https://www.w3schools.com", 'BackfliptOAuth', "width=800,height=800,center=true,useContentSize=true");
}
我将其修改为:
var win = null;
function myFunction() {
win = null;
win = window.open("https://www.w3schools.com", 'BackfliptOAuth', "width=800,height=800,center=true,useContentSize=true");
}
推荐阅读
- python - 如何在带有脚本包的原子中使用 conda 环境运行 python?
- python-3.x - 抓取网页后,我立即收到错误 http.client.RemoteDisconnected
- javascript - d3.js - 为什么在调用 transform 到 svg 本身时使用 d3.zoom() 拖动会导致抖动?
- python - 如何从列表中找到相似但不准确的值?
- java - 依赖注入的 MainActivity
- javascript - 在网站上,当数据层中第三方控制的 javascript 变量的值发生变化时,每次都向我的服务器发送信息
- javascript - 将数组转换为排序对象
- python - 用多种方法替换方法
- vb.net - 使用 HTML 敏捷包 (VB.net) 从 WebBrowser 活动中抓取文本
- linux - 在使用 yes/no 子句的期望脚本中处理双重身份验证的问题