I am using Telerik UI controls. They have a embedded JS, which looks like is having some dependency on Safari 9.0.3(10601.44) Developer console.
When we try to load telerik tree-view in telerik combo box, we get the followin error. Only in Safari 9.0.3(10601.44)
Same in text
_initRightToLeftScriptResource.axd:8396TypeError: null is not an object (evaluating 'c.set_additionalQueryString')
_initRightToLeftScriptResource.axd:8395
initializeScriptResource.axd:8332
endUpdateTelerik.Web.UI.WebResource.axd:2:49050
endCreateComponentsTelerik.Web.UI.WebResource.axd:2:63458
_raiseInitTelerik.Web.UI.WebResource.axd:2:65559
_doInitializeTelerik.Web.UI.WebResource.axd:2:63974
(anonymous function)Telerik.Web.UI.WebResource.axd:2:65784
(anonymous function)Telerik.Web.UI.WebResource.axd:2:50713
pTelerik.Web.UI.WebResource.axd:2:558
_2PassTelerik.Web.UI.WebResource.axd:2:50697
My problem is very similar to this Why does JavaScript only work after opening developer tools in IE once? but in Safari.
I tried all those suggestions, none of them were helping.
Update
Code works fine with some delay in calling function.
if (navigator.sayswho === "Safari 9") {
setTimeout(function() {
try {
loadInit();
} catch (e) {
alert("error");
console.log(e);
}
}, 1000);
tried all following, none is working, not sure how to trace the right event of full DOM is loaded and no pending ajax calls happening.
$(document).load(...)
$(window).load(...)
<body onload="....">
Since you are using Telerik controls, use:
Sys.Application.add_load(MyFunction);
function MyFunction(sndr, args){
//your code
}
This only calls the function once all the telerik controls have loaded.
Related
I have an MVC application and I am using a gif to indicate loading by using JQuery.
The code below works okay on Chrome.
// show loading
window.parent.loading(true);
$.get('#Url.Action("getUserAccounts")', function (data) {
$("#usersAccountsDiv").html(data);
window.parent.resizeIframe();
});
However, in Firefox, the loading indicator freezes along with the whole page. Since the operation is not taking too much time, I tried to mock this by using a sleep function like that and the results were the same on Chrome and Firefox. While Chrome keeps playing the gif, Firefox stops playing it:
window.parent.loading(true);
$.get('#Url.Action("getUserAccounts")', function (data) {
function (data) {
function sleepFor(sleepDuration) {
var now = new Date().getTime();
while (new Date().getTime() < now + sleepDuration) {
/* Do nothing */
}
}
sleepFor(10000);
$("#usersAccountsDiv").html(data);
window.parent.resizeIframe();
});
I used w3schools' editor to see the difference:
w3 try editor
I used this code below in both browsers for comparison:
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#showMe").show();
$.get("demo_test.asp", function(data, status){
function sleepFor(sleepDuration) {
var now = new Date().getTime();
while (new Date().getTime() < now + sleepDuration) {
/* Do nothing */
}
}
sleepFor(10000);
});
});
});
</script>
</head>
<body>
<button>Send an HTTP GET request to a page and get the result back</button>
<div id="showMe" style="display:none">
<img src="https://media.giphy.com/media/3o7bu3XilJ5BOiSGic/giphy.gif" />
</div>
</body>
</html>
I tried to mock it that way because I could not reproduce this issue on my local. It only happens in QA environment. The operation takes longer in QA and that causes Firefox to freeze.
On Firefox, once the code hits to $("#usersAccountsDiv").html(data); function, the problem occurs. That's why I remove .html() function and replaced it with sleepFor function to make the JS engine wait on Firefox. My expectation was gif should keep playing as it does in Chrome while I wait for sleepFor function to end.
First, replace
sleepFor(10000);
$("#usersAccountsDiv").html(data);
window.parent.resizeIframe();
with
window.setTimeout(function() {
$("#usersAccountsDiv").html(data);
window.parent.resizeIframe();
}, 10000);
See https://developer.mozilla.org/en-US/docs/Web/API/setTimeout for usage of setTimeout().
Do not make busy-waiting loops like your function sleepFor() - this precisely bogs down the browser's JavaScript engine.
Then, I suggest to focus on the first code snippet (without sleepFor() nor setTimeOut()) and use the Firefox debug console (press F12 key) to figure out what kind of answer you get from the server on your get() request.
To do this, press F12, a sidebar opens, go to the "network" tab and look for the GET request that your code sends (each GET is a line, timing diagram to the right of it). Select it by clicking, another sub-window opens with details of the GET request - go to the "response" sub-window and inspect whether it is what you expect.
I have checked the response data returning from get action and I found the solution. Returned html data contains 18 lines of scripts.
$("#usersAccountsDiv").html(data);
After that, I debugged the JQuery html and append methods and realized that script tags are making Firefox freeze in a for loop (domManip function). I resolved the issue by reducing the included scripts to my response but it is still a weird problem. All those scripts are working fine on Chrome but not on Firefox.
Thanks!
i want to show loading gif until data loaded with jquery mobile
but it does not work ..in console it give that error
Uncaught TypeError: Object #<Object> has no method 'loading'
this is my page :enter link description here
and in this page that i added code
$.mobile.loading( 'show');
and this not work:enter link description here
my code
<script type="text/javascript">
$('#details').live('pageinit', function (event) {
$.mobile.showPageLoadingMsg();
$("#listeu").empty();
$.getJSON('http://teknonova.com/Map/Home/getir3/1', function (data) {
The error sounds like either the jquery mobile library wasn't loaded properly (maybe loaded before jquery and failed init) or the version of jquery mobile doesn't support that method.
I'd use the dev console to see what the $.mobile object is for more clues
I am using Thickbox 3.1(by cody lindley) in my asp.net application. While closing thickbox I am getting jquery error from file "jQuery UI Tabs 1.7.2" file which is for showing image slider on the same parent page,
Error is :-
Microsoft JScript runtime error: Unable to get value of the property 'add': object is null or undefined.
and while debugging its coming from the below code,
a(window).bind("unload", function ()
{
p.lis.add(p.anchors).unbind(".tabs");
p.lis = p.anchors = p.panels = null
})
as "p.anchors" is coming null, but how to solve this issue.
Just got the solution guys, great effort on by "maxchirkov" on weblink http://wordpress.org/support/topic/wp-32-thickbox-jquery-ui-tabs-conflict.
The issue was from "unload" event conflict in the thickbox and Jquery-UI-tabs scripts.
In the thickbox.compressed.js, I hv changed:-
// $("#TB_window").fadeOut("fast", function () { $('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove(); });
above code to :-
$("#TB_window").fadeOut("fast", function () { $('#TB_window,#TB_overlay,#TB_HideSelect').unload("#TB_ajaxContent").unbind().remove(); });
and its working now.
How can I show or hide the entire Firebug panel and its icon at runtime ?
I browsed through Firebug.chrome but could not find anything appropriate.
I tried the following snippet which did not have any apparent effect, Firebug Lite was still there.
Firebug.extend(function (FBL) {
alert('TEST'); // This is run
FBL.Firebug.chrome.deactivate(); // No errors but nothing happens
});
The anonymous callback function is definitely invoked.
Quite an old post, but still popping on google search for such a question.
I'm not even sure which version of Firebug Lite you were using, but the following works well with 1.4.0 (once the page has loaded):
Firebug.chrome.open();
Firebug.chrome.close();
Firebug.chrome.toggle();
Firebug-Lite is enabled through the javascript function in the bookmark, and from there it just loads the javascript hosted at getfirebug.com.
If you control the website you're looking at, and want firebug to pop-up for that website, then you can add this to your code:
<script type="text/javascript">
function bookmarklet(F,i,r,e,b,u,g,L,I,T,E){
if(F.getElementById(b))
return;
E=F[i+'NS']&&F.documentElement.namespaceURI;
E=E?F[i+'NS'](E,'script'):F[i]('script');
E[r]('id',b);
E[r]('src',I+g+T);E[r](b,u);
(F[e]('head')[0]||F[e]('body')[0]).appendChild(E);
E=new Image;
E[r]('src',I+L);
}
$(document).ready(function() {
bookmarklet(document,'createElement','setAttribute',
'getElementsByTagName','FirebugLite','4','firebug-lite.js',
'releases/lite/latest/skin/xp/sprite.png','https://getfirebug.com/','#startOpened');
});
</script>
Or, did you mean that when you're browsing you always want Firebug / Firebug-Lite at the bottom?
I have a ASP updatepanel, within that panel I have some controls which got jQuery effects connected to them.
The effects work perfect before posback, after postback the effects only work in IE not in FF.
To get it working in IE I added the following to my MasterPage:
function pageLoad(sender, args)
{
// Initialize jQuery effects.
}
With this code it works in IE but bot in FF, anyone got an answer to this one?
You need to rebind your effects after the UpdatePanel finishes loading. You can achieve that by adding the following code:
<script type=”text/javascript”>
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_pageLoaded(panelLoaded);
function panelLoaded(sender, args){
// Rebind your elements/effects here.
}
</script>
The pageLoad shortcut definitely does work the same way in Firefox as in IE. Double check that you don't have any JavaScript errors that are only throwing in Firefox.