I'm using the following code to get contact presence on a web page:
nameCtrl = new ActiveXObject("Name.NameCtrl.1");
if (nameCtrl && nameCtrl.PresenceEnabled) {
presenceEnabled = true;
nameCtrl.OnStatusChange = onPresenceStatusChange;
// ...
}
It works perfectly when I run it in VS but only from a separate Internet Explorer window, doesn't work in the debug IE window started by Visual Studio (so I cannot debug JS code). What happens is that initially nameCtrl.PresenceEnabled is set to true (just after creating ActivexObject) and then is changed to false, I don't get any status updates and all GetStatus calls return 1.
Any ideas how to make it work in Visual Studio?
I'm targeting IE and Lync.
The whole nameCtrl turns out to be very difficult to debug. Some things to check:
If the plugin doesn’t work in IE11, but works if you change the document mode to IE10, it is because IE11 no longer recognizes ActiveXObject as a property of the window object. (see: http://msdn.microsoft.com/en-us/library/ie/dn423948(v=vs.85).aspx).
No javascript errors but nothing seems to be working? For this to work, you may need to go into Internet Explorer’s Internet Options menu and add your domain (or localhost) as a trusted domain.
Related
I am listening to a server event via a javascript function on my HTML file, which outputs the server answer in the console tab. Since I need to pass this answer to a delphi application, I made the server answer "visible" via a div container. This works fine on Firefox, but on IE the output is not shown. I have then tried to utilize the value of a textarea, which also works on Firefox but not on IE.
I really wonder why it is so hard to get a console output visible on IE?
document.getElementById('my_div_container').innerHTML = JSON.stringify(my_data_I_want_to_see, null, 4);
document.getElementById('my_textarea').value = JSON.stringify(my_data_I_want_to_see, null, 4);
The above lines show a result on Firefox, but on IE there is no output at all. How can I get my data visible on IE?
I found the root cause why IE did not show any console output. I just found out, that the addEventListener() method I was using is not supported in Internet Explorer 8 and earlier versions.
I am very sorry for any confusion.
If you are using TWebBrowser component in Delphi for displaying the webpage do note that by default it running in Internet Explorer 7 compatibility mode.
In order to avoid this you need to opt your program into browser emulation feature
How to have Delphi TWebbrowser component running in IE9 mode?
Don't forget to check MSDN documentation for proper registry value to enable emulation of most modern IE versions.
I have WebView in a UWP application that loads webpage, and I have InvokeScriptAsync Method that calls JS function:
InvokeScriptAsync("myFunction", new List<string>());
This code, fires myFunction correctly, and the return is correct.
function myFunction(){
...
return true;
}
But, when I have strange bug... when I set breakpoint in this call, the app blink and latter stops working correctly, but if I remove this breakpoint, the application works fine.
In another side, when I debug JavaScript with Script option in debug settings, the .NET application Works correctly and apparently JavaScript too, but when myFunction return a value, blink again and app stops working.
I'ts posible that debug application influences the behavior of the application? Any idea to find the bug?
Thanks
I can't set breakpoint in C# code and Javascript code at the same time
It is not a supported feature to debug managed codes(C#) and javascript in one Visual Studio Instance. Please see Support Javascript/Managed mixed mode debugging.
So I am writing a shortcut library and for the most part it works, except for the issue I found right off the bat is in Chrome (haven't tested other browsers since I'm on a chrome book) is that when pressing ctrl+n it creates a new browser window. Basically in jist my code checks if the current key selection is defined and if it is preventDefault and run the exec function of that command.
ie.
if(joinedKeys in commands.cmd)
e.preventDefault();
commands.cmd[joinedKeys].exec();
I've even tried just doing this-
document.addEventListener("keydown",function(e){
e.preventDefault();
});
//as well as window.addEvent...
Neither work. Any suggestions as to stop the default action of the browsers?
See https://stackoverflow.com/a/7296303/5298696
In Chrome4, certain control key combinations have been reserved for
browser usage only and can no longer be intercepted by the client side
JavaScript in the web page. These restrictions did not exist in
Chrome3 and are inconsistent with both Firefox3/3.5 and IE7/8 (on
Windows).
I'm using Selenium WebDriverJS (via node) to do some automated testing. I have a test I'm trying to write to work on multiple browsers, and it works fine on Chrome and Firefox, but in IE (version 11, 32-bit), I keep having the consistent problem where I can't switch to other windows besides the main one.
Basically, as part of the test I'll have it click a button that opens up a link in a new window, then I attempt to switch to that window and continue. Getting all the window handles and then using switchTo() to switch has worked fine in the other browsers, but not IE. Using the same method gets me the error:
UnknownError: null value in entry: name=null
...
==== async task ====
WebDriver.switchTo().window(undefined)
So I ran:
driver.getAllWindowHandles().then(function (handles) {
console.log(handles.length)
});
to see if the windows were appearing. And every time, the result has been 1, being only the main window. I can see the new windows that have been opened, but webdriver can't for whatever reason. Is there anything more I need to do to get these windows to be visible to the driver? Any sort of workaround?
I know that IE requires some settings to work properly with Selenium. My protected mode settings are fine, and I've done the FEATURE_BFCACHE key in the registry. It just seems to be unable to find any new windows.
Using IE 11 with the 32-bit driver, and Windows 7 64-bit. Again, my language is javascript. Let me know if there is more info you need to answer.
Both firebug and the built in console in webkit browsers make it possible to set breakpoints in running Javascript code, so you can debug it as you would with any other language.
What I'm wondering is if there is any way that I can instruct firebug or webkit that I'd like to set a breakpoint on line X in file Y at runtime, and to be able to examine variables in the specific scope that I have paused in.
I need something that can work in both Chrome (or any other webkit browser) and Firefox. For the latter Firebug is an acceptable dependency. Supporting IE is not a requirement.
I've been building an in-browser IDE ( quick video for the interested: http://www.youtube.com/watch?v=c5lGwqi8L_g ) and want to give it a bit more meat.
One thing I did try was just adding debugger; as an extra line where users set them, but this isn't really an ideal solution.
I'd say you can definitely do this for webkit browsers using the remote debugging protocol. This is based on a websocket connection and a json message protocol that goes back and forth.
You can read the announcement and the whole protocol schema.
Chrome also offers more information about this inside its remote developer-tools docs.
For the debugger domain, for instance, you can see how you can use Debugger.setBreakpoint, Debugger.setBreakpointByUrl and Debugger.setBreakpointsActive to work with breakpoints.
On the other hand, Mozilla also seems to be working on this as you can see in https://developer.mozilla.org/en-US/docs/Tools/Debugger-API and https://wiki.mozilla.org/Remote_Debugging_Protocol though I don't know the completion status of it.
In this case, you can work with breakpoints using the Debugger.Script APIs setBreakPoint, getBreakPoint, getBreakpoints, clearBreakpoints and clearAllBreakpoints
I hope this helps you move forward.
There isn't such a thing, at least not using the public, scriptable side of JavaScript. It would be possible if you have a privileged browser extension that could do that for you. For example, Firebug has a debug method which you can call from its command line, but not from scripts inside a page.
So, you have two solutions:
Implement your own JavaScript interpreter, which you can control as you wish. Might be a bit too ambitious, though...
Rely on a browser extension that can set breakpoints anywhere in the code, expose some API to public code, and interact with it from your JavaScript. But that means that users will have to install some extra piece of software before they can use your "Web IDE".
Use _defineSetter__ to watch variables, and combine it with a call to debugger when an assignment happens.
__defineSetter__("name", function() { debugger; });
or defineProperty:
function setter () { debugger; }
Object.defineProperty(Math, 'name', { set: setter });
References
MDN: Object.defineProperty
A List Apart: Advanced Debugging With JavaScript
JavaScript Getters and Setters