electron js doese not load jquery properly - javascript

I have a web page and when I open it in chrome or fireFox, everything is fine, but when I try to open it in electron js with window.loadURL() it comes up with lots of errors because the jquery has not loaded.
Ive tried so many things (injecting js, adding jquery script tag and ...) but the main problem is some of events in those pages are related to document.ready and they are screwed
whats the problem and how should I fix it?
ps: lots of pages has this problem, but a url to test:
online.agah.com

It seems nobody is interested, but however if someone had the same problem, the answer is use the webview instead of loading url in the window.
when the url loads in the webview, magically everything is fine.

Related

Django served bootstrap.js file not working in mobile

Edit: So I've narrowed the problem down - it works when I link to an externally hosted bootstrap.min.js file, and doesn't work when I use the local file (django's dev static folder setup)
This has me pulling my hair out. I've looked at tons of threads, inspected the HTML very carefully, and I can't tell what's the difference. Here's my dev page: http://iceberg.creatifcubed.com:8080, and here's the jsfiddle http://jsfiddle.net/5UAUP/4/
The problem is on a mobile browser (iPhone and iPad) the login dropdown closes when I click on it. Many threads recommended e.stopPropagation() - which is showing up in a desktop browser but not on the mobile browser. I added some alerts, and tried different variations to attach the event - and it's not being called in mobile safari.
I add the same code into jsfiddle - and it works there (copied and pasted the same HTML - see jsfiddle /5UAUP/5). Don't even need e.stopPropagation(). I ran my code through the w3 validator and there are no errors. Any idea what could be causing this?
Currently, my page is set to use the local static file. It's been included properly and everything - you can see it at http://iceberg.creatifcubed.com:8080/static/lib/bootstrap-2.3.0/js/bootstrap.min.js . I've checked the headers, and I don't see anything strange - so why does it cause that javascript bug when I link to the local file? Other parts of the file - like the carousel plugin - seem to be working.
The solution is actually much easier than you'd think and it's unfortunate that people have to waste time on this little quirk, but I promise now that you know it, you'll never forget it!
$('.dropdown form').on('click tap', function (e) {
All you have to do is add a "tap" handler, so that mobile browsers react to it properly. By the way, this DOES work because jquery will automatically split up event handlers by spaces, so "click" and "tap" are two distinct handlers
The problem was actually a bug in 2.3.2. Github issue: https://github.com/twitter/bootstrap/issues/7927
Just the way I tested 2.3.0, 2.3.1, and 2.3.2 with serving from Django vs. CDN and accidentally caching just happened to not show me it was nothing to do with django until after asking this question >.<

Facebook Comments in iOS with loadHTMLstring

I have problem with Facebook Comments plugin. Is it event possible to embed it on UIWebView in iOS application? I don't mean using loadUrl method ... but using loadHTMLstring ( I want it only localy on my application, without using any messy obj-c code if it's possible ). I'm using HTML5 code for it, but it's not working on simulator ...
Am I doing anything wrong?
I've read similar topics, but haven't found any solution, that might help me.
Thank's in advance for any help!
well, i found some workaround for this problem. what i needed is to load local html page with comments plugin embedded. this html page is stored in resources of project. so the code for me was something like that:
[reviewsView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:#"comments" withExtension:#"html"]]];
where reviewsView is a UIWebView element. however, it didn't work correctly in the end - comments had loaded, but facebook "loading progress bar" was still animating and for some reason login button was unclickable. so i just returned to the idea with remote html comments page.

Javascript code loading issue with IE7 and IE8

The website in question is cpavalet.com
My javascript loads fine on all browsers except ie7 and ie8. For a few hours now I have been trying to debug the issue to no avail.
I am using jQuery and modernizr, and using the supersized library for the full-sized background images.
The weird thing is, sometimes when I load the page it loads correctly, other times the javascript doesn't work on the page. I think it has to do with the order the scripts are loaded. I am using document.ready for my jquery scripts.
Can anyone shed some light as to why it's not working correctly in ie7 and ie8? I am currently using ie8 for testing purposes.
I am using javascript for: image slider on home page, full-size background images, back to top link to slide to the top, and form validation.
Thanks!
Corey
My guess as to why it wasn't loading correctly was partly correct. I thought that it was because of the order I had my scripts being run on the page.
The answer is that I was using the defer attribute when loading my scripts. When I removed the defer attributes, the scripts started working correctly again.

Asp.net ModalPopupExtender flickering during PostBack

I'm working on a web application that requires me to use a modalpopup I recently made within a user control. Everything works as expected, but somehow after a PostBack, and not always, the panel used in the modal flickers (blink) on the screen very briefly.
I have read on dozens of forums saying that I needed to add "display:none;" to the style tag of this panel. This usually "helps", and most of the postbacks don't show the panel, but some do. Seems that the property is being ignored somehow, but I can't find where, how, when.
I have also tried debuging the javascript with firebug, tested all page events and even tried taking a look at the ajax modalpopupextender sourcecode, but couldn't fix this issue.
The browser I HAVE to make this web application work is Mozilla Firefox 3.5.10, that is the current version on the company I work for. This can't be changed due to corporate policies.
Due to quality and user experience issues that arise with this flickering, I leave it as is, so if anyone can help me out I'd appreciate that. I'm also on a rather tight schedule, so any quick help will be appreciated too, as I'm ready to try and test changes on the go.
Please let me know of any doubts or questions.
Thanks in advance.
If your CSS is in an external file, it's possible that the HTML is being loaded and rendered before the CSS is downloaded, causing the flicker. If this is the case, then adding style="display:none" directly to the HTML tag ought to fix it.
The following works for me:
<script type="text/javascript">
window.onbeforeunload = function () {
document.getElementById("PanelDialog").style.display = "none";
}
</script>

why does firebug debugging sometimes work and sometimes not?

I want to debug a javascript file that is embedded in the HEAD element.
I navigate to the site, see the code, and make a breakpoint:
(source: deviantsart.com)
But when I click on Reload, the script disappears and it doesn't stop at the breakpoint:
(source: deviantsart.com)
Debugging was working earlier so I know it works in general. What do I have to do so that Firebug always debugs my script?
I've noticed this behaviour before as well. It seems that it can happen if you refresh the page while the debugger is running (i.e. after you've hit your breakpoint and are stepping through code). This is far from conclusive, just something I've casually observed over time.
Also, I try to avoid having multiple tabs open with firebug active, as it seems to get confused.
Edit: just thought I'd add that I've seen this manifest itself in a few different ways:
the external script file does not appear at all in the scripts panel.
the external script file appears but firebug doesn't "see" it. You know this has happened because the line numbers beside the code where a breakpoint can be set won't be highlighted (used to be green but now appear to be just a darker shade than other lines). I've seen this happen with inline javascript on a HTML page (horrors!) as well.
the external script file is there, but you can only see a single screen full of code. Where "screen full" is the firebug panel viewport.
shut down firefox and then restart. sometimes firebug gets confused. also make sure you have the latest version.
You need activate the script tab
I'm not sure that having a <script> inside <head> (as opposed to, inside <body>) is actually legal HTML. If it's not, as I suspect, you can't fault Firebug for not supporting it well...!-)
The bugs in script processing that I know about are 1) jquery dynamic loading of scripts fails, 2) new Function() cannot be seen, 3) some kinds of document.write() cannot be seen.
Firebug processes script files in series with Firefox. This means that Firebug must be active when the page loads and it means that any exception in the path will cause the files to be mis-processed. If you opened firebug before loading and you still see problems, then the most likely fix is to install Firebug in a new Firefox profile. This causes you to get a completely fresh set of default options and you run Firebug without other extensions. As you re-add other extensions, look for problems in seeing scripts: then maybe you will discover what extension is interfering with the code path for processing scripts. I know this is a pain in the neck, but so is JS debugging without source ;-). We are working on testing with more Firebug and Firefox extensions installed to try to reduce these problems.
In our case it was the bundling of JS files.
It is not only FireFox, it is same for Chrome.
We moved the file out of the bundle and put it on the page where it needed to be referenced and it started working like charm.

Categories