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.
Related
I'm using Firefox Quantum (64.0) and the JS command new WebSocket() returns a different object from the specification:
MDN Websocket
HTML Standard
The missing property that is affecting my appllication is the .close() function, but there is another differences.
You can see in the image bellow that the returned object has a .websocket porperty that contains all the missing ones.
websocket object
Am I doing something wrong? With older versions of Firefox (before Quantum, like 43) or with chrome it works fine.
If it is a problem with firefox, how can I report it?
EDIT:
Adding some code example:
var exampleSocket = new WebSocket("wss://echo.websocket.org");
exampleSocket.close() // Throw "exampleSocket.close is not a function" in Firefox Quantum, works on chrome
exampleSocket.websocket.close() // Works on Firefox, Throw on chrome.
This exampleSocket.websocket is not in the documentation.
Edit2:
I tested in other machines that have the firefox versions 60, 61, 63 and 64 and the problem only happened in my machine.
When I removed all plugins from firefox it started to work again.
The problem was the websocketsniff plugin that I had installed.
It even state that the WebSocket object will change:
Inspect websocket frames in Firefox. How to use: 1) Open Developer
Tools 2) Open "Websocket Sniffer" tab
This extension replace native websocket object for custom object. It
is dirty hack, but it is single decision
I have a web application written 15-18 years ago, I am working on asp.net web page which is using obsoleted iframe. the below line of code only works in IE8 and getting objects count =1439, the same line ignores by all other browsers and return null.
Iframe code:
var frame = window.document.all.tooltipFrame;
I resolved this issue by accesing the element and fixed my code behind instead.
Thank you
As you can see from the MSDN documentation. document.all is no longer supported:
[all is no longer supported. Starting with Internet Explorer 11, use getElementById. For info, see Compatibility changes.]
So I've got this code that runs inside a HTA...
jsv=ScriptEngine()+' v'
+ScriptEngineMajorVersion()+'.'
+ScriptEngineMinorVersion()+'.'
+ScriptEngineBuildVersion()
It displays the version of JScript the HTA is using.
So... My question is:
Can I display the IE Compatibility Mode version, or similar, of the HTA in the same way?
And if so... How?!
In IE8 and later, you can retrieve document.documentMode. It gives you a number representing the current document mode, 5 for quirks-mode, 6 for IE6 etc.
In IE6-7 there was document.combatMode, which returned a string telling you whether the standards-compliant mode is switched on or not.
Notice, that ScriptEngine returns the latest available JScript version, the used document mode doesn't change the values.
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.
I'm playing around with jQTouch for an iPhone OS app that I've been toying with off and on for a while. I wanted to try my hand building it as a web app so I started playing with jQTouch. For reference, here is the page+source (all my code is currently in index.html so you can just "View Source" to see it all):
http://rpj.me/doughapp.com/wd/
Essentially, I'm trying to save pertinent JSON objects retrieved from Google Local into DOM objects using the data() method (in this example, obj is the Google Local object):
$('#locPane').data('selected', obj);
then later (in a different "pane"), retrieving that object to be used:
$('#locPane').bind('pageAnimationEnd', function(e, inf) {
var selobj = $(this).data('selected');
// use 'selobj' here ...
}
In Chromium and Safari on the desktop OS (Snow Leopard in my case), this works perfectly (try it out).
However, the same code returns undefined for the call to $(this).data('selected') in the second snippet above. I've also tried $('#' + e.target.id).data('selected') and even the naive $('#locPane').data('selected'). All variants return undefined in the iPhone OS version of WebKit, but not on the desktop.
Interestingly, the running this on Mobile Safari in the iPhone Simulator fails as well.
If you look at the full source, you'll see that I even try to save this object into my global jQTouch object (named jqt in my code). This, too, fails on the mobile platform.
Has anyone else ever ran into this? I'll admit to not being a web/javascript programmer by trade, so if I'm making an idiot's error please call me out on it.
Thank you in advance for the help!
-RPJ
Update: I didn't make it clear in the original post, but I'm open to any workaround if it works consistently. Since I'm having trouble storing these objects in general, anything that allows me to keep them around is good enough for now. Thanks!
Have you tried using HTML5 data-ref attributes? The data has to be stringified, but you can just do
$('#locPane').attr('data-selected', "somestring");
and still have valid HTML5 markup.
As far as I can tell there seems to be a bug in Mobile Safari storing objects like this. So what I did was to simply store the components of the object in the documents data store.
$(document).data( "lessonCode" , lesson.lessonCode);
$(document).data( "question" , lesson.question);
$(document).data( "answer" , lesson.answer);