Bug when printing <iframe> in Google Chrome 35 - javascript

So, I'm getting complains from my users that the print feature of our website is not working anymore. After some investigation, I found out this is a problem specific to the recent version of Chrome (number 35, released May 20th 2014). So the traditional code
window.frames[ "my-iframe" ].focus( )
window.frames[ "my-iframe" ].print( )
is now broken in Google's browser. The error is:
TypeError: object is not a function
Other people are having similar problems (here and here).
It looks like window.frames[ "my-iframe" ] is returning a frameElement instead of the DOM object.
Any solution or workaround to fix this print issue just for Chrome?

Sorry, guys! My bad. I was using "id" instead of "name" inside the iframe. Safari was understanding it anyway, as well as previous versions of Chrome.
Simple solution, apparently.

Related

Sys.Application.add_init error in dynamic code

I am at a loss, and somewhat out of my depth. There is an older application that I have inherited, and my attempts to get it up and running have met with partial success. The extremely odd behavior I am seeing seems to be related to Internet Explorer 11, as my partial successes have been in Chrome and Firefox. When the application is executing, I receive a JavaScript error, that a } was expected. Upon looking at the code, I am in login.aspx [dynamic] (Visual Studio 2013 Ultimate - forgot to mention). The code that is causing the problem is:
Sys.Application.add_init(function() {
$create(SomeType.Web.WebControls.BasePageBehavior,
{"id":"SomeControl_callbackExtender","processorStateDataId":"SomeCo="ntrol_callbackExtender_psdh","exceptionPageUrl":"/ExceptionInformation.aspx"},
null,
null,
$get("SomeControl"));});
As can be seen, for the Properties, the value =" has been inserted into the middle of the JSON object. I have no idea why, although I'm leaning towards something out of date, or at least, out of date for IE 11.
All the scripts seem to go through the proper process of being registered (ScriptManager.RegisterStartupScript), so... ? I've never heard of this, nor was I able to find anything like it on the web. Any thoughts or help is appreciated.
Final thoughts, I have set IE11 to run this site in compatibility mode. That got me to the point of being able to see the error.
Found the work around, although I haven't figured out the WHY yet... It was in this other issue: Visual Studio 2013 produces garbled/corrupted/wrong-encoded html.

Unhandled exceptions in jQuery 2.2.1 ("Cannot find function createHTMLDocument in object" & "Cannot convert a Symbol value to a string")

I've recently updated from an older 1.x version of jQuery to the latest 2.2.1 and mostly it seems to be running just fine. Unfortunately I'm constantly receiving 2 error messages in raygun which I don't know how to handle:
The first one is Cannot find function createHTMLDocument in object and only happens in Firefox 24.0 under Win 7 (according to raygun).
The second one states Cannot convert a Symbol value to a string and only happens in Firefox 38.0 in the OS reported as Linux Core.
Both errors don't provide any stack trace (at function () line null, column null (null:null)) and I can't reproduce neither one myself using the same FF & OS version using browserstack.
I'm not quite sure if those errors where already happening earlier in the older jQuery version since I was loading this version from a different CDN which didn't provide any useful errors from within jQuery at raygun at all due to same origin stuff.
One more thing: If it turns out, that those errors actually happen in some legacy browsers which just report an incorrect version 24 & 38, I'd also be happy to know, how to detect those browsers early so that I can show them an appropriate message before the errors occur.
I'd really appreciate any help/input on how to tackle this issue since I'm a little clueless by now.
Thanks

Javascript with IE 11 issue

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.]

What do I get an error with highcharts, only in IE8

The charts are working ok in most browsers, including firefox and Opera. However in IE I am getting:
Object doesn't support this property or method
report_graph.js
Code: 0
URI: http://10.11.4.92:5000/assets/report_graph.js?body=1
It's possible that you're calling the javascript file along with a query-string attached. Check out: Passing Querystring style parameters into Javascript file and Passing parameters to JavaScript files for possible solutions.
It wa all due to a `.trim() at the end of some of the code !
e.g. I had $('some selectors).text().trim()
Changing it to $('some selectors).text().trim() fixed it.
As it actually has worked ok in some browsers this seems to suggest an actual issue with the javascript engine in IE. Either it doesn't support the method that other browsers do... or it does not handle the error as gracefully, causing a runtime exception for a error that other browser ignore.

jQuery.data() works in Mac OS WebKit, but not on iPhone OS?

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);

Categories