DOJO include script from CDN - firefox

Currently I'm trying to include Dojo from either one of these two CDN (Content Delivery Network) sources:
1) o.aolcdn.com/dojo/1.3.2/dojo/dojo.xd.js
2) ajax.googleapis.com/ajax/libs/dojo/1.3.2/dojo/dojo.xd.js
It seems like some times during the day, Firefox 3.5 refuses to load the dojo library.
I see errors in Firebug console like "dojo is not defined" when I do a "dojo.require" statement. Also from Firebug and go to the "Net" tab, and see no history of any attempt to load from the above dojo libs.
Yet, I can open the same page in IE7 and it works. I have flushed cache in FireFox, and killed and re-opened it (but I was using the restore previous pages option).
One time today, when I switched from AOL 1.3.2 to 1.1 it worked once, then never has worked again.
Thanks,
Neal

Sounds like timing issues. Are you sure you do CDN right? The trick is you cannot use what's defined in files you dojo.require()d right away — they are going to be loaded asynchronously.
The basic structure of the CDN-based application is like this:
<script src="to/dojo/cdn"></script>
<script>
dojo.require("dojo.this");
dojo.require("dojo.that");
// more dojo.require()
// you cannot use dojo.this and dojo.that here
dojo.addOnLoad(function(){
// this is crucial: do everything in dojo.addOnLoad();
// now use dojo.this and dojo.that
dojo.this(dojo.that);
});
</script>
In order to troubleshoot you can do one thing: write a minimal web page, which loads Dojo using your favorite CDN and does nothing. Open it up in Firefox, open Firebug and enter some simple Dojo calls manually to see if it works for you. If it doesn't, switch to the Net tab and see what calls were made, when, and how they ended.

Related

console.log is not working when used in a Firefox, Greasemonkey script

My userscript prints some information using console.log().
This works fine in Chrome, but when I install this userscript in Firefox (Greasemonkey), the web console in Firefox is not displaying anything.
I searched for a solution and some suggested to use unsafeWindow but it is also not showing any output. Moreover unsafeWindow cannot be used for chrome. I even installed Firebug but it was no use. How can I resolve this?
For example, I tried this userscript in Firefox:
// ==UserScript==
// #name console
// ==UserScript==
console.log("hello");
You mean it doesn't work when installed via Greasemonkey, right?
Not long ago, Greasemonkey broke console.log (New! Bug report). Now, to see the results of a plain console.log() call from a Greasemonkey, you need to look in Firefox's Error console, not Firebug's.
You can see FF's Error console by pressing: CtrlShiftJ.
However, you can use unsafeWindow.console.log() in both Chrome and Greasemonkey scripts. Chrome now has limited support for unsafeWindow.
If you use unsafeWindow, you have access to the full range of Firebug's logging functions from Greasemonkey. (Firebug must be installed and they still might not work in Chrome userscripts; I haven't tested that way in a while.)
In Firefox, if Firebug is not installed, or it is not active for the page, then unsafeWindow.console.log() calls will display to the New "Web Console" (CtrlShiftK).
You need to use the unsafeWindow when inside a Greasemonkey script.
Note that Firefox currently supports console.log(), console.info(), console.warn(), and console.error() natively -- no Firebug required.
Wait a minute: if the question is about logging in the console with Greasemonkey (I could swear I saw the tag greasemonkey), why not use the GM_log method?
// ==UserScript==
// #name GM_log Example
// #namespace http://www.example.com/
// ==/UserScript==
GM_log("This is an example of GM_log");
Or am I missing something?
PS: you can also check for javascript.options.showInConsole in about:config. it should be true.
I found that (testing with Chrome/Tampermonkey) you need:
window.log("<message goes here>");, not unsafeWindow.console.log("<msg>");,
as unsafeWindow and console come up as undefined.
Try that, as I'm pretty sure that's the way you're supposed to do it in later versions of browsers, etc.

CSS file not updating on Azure Deploy/Publish

RESOLVED
Unbeknownst to me, Cloudflare defaults to caching all css/js files for 4 hours.
Scenario:
I add this to our front page:
<span class="test">hullo!</span>
and this to our css file:
.test { font-size:2.0em; }
I do a web deploy, OR full publish to Azure and the span appears on the front page, but not the styling. The css file for some reason does not get updated. FF, IE, Chrome and Safari all confirm it. However, after a seemingly arbitrary time, the css file get updated.
Even when I remote into the Azure VM and restart the app, the styling is unchanged. The app is running on one instance, one role. No Azure Caching is setup. Adding a querystring param to the css file link does not help. Seems like a caching issue but no clue how to resolve.
Any ideas?
"We are using Cloudflare which has a default set up to cache all CSS and JS files. It purges the cache every 4 hours which resulted in the arbitrary updates. So, even though I was adding a new query string to the end of the css file, Cloudflare still cached the old one"
Just a quick note that you should go to CloudFlare Development Mode when making changes to the static content files on your site. You can get to Development Mode to bypass the cache by going to: settings->Development Mode. You also have the option of purging your cache as an additional option, which we would only recommend if you really want to purge everything.
Looks like it's cached by your browser. Can you please try navigate to your site and press Ctrl+F5.
Maybe you can use Fiddler to see if the CSS had been cached, or not updated, or some error when download.
This issue is resolved.
We are using Cloudflare which has a default set up to cache all CSS and JS files. It purges the cache every 4 hours which resulted in the arbitrary updates. So, even though I was adding a new query string to the end of the css file, Cloudflare still cached the old one.
I have dealt with this and I will tell you that from my experience in Chrome you can set a setting that disables the cache in the developer tools, however, I've noticed that unless you have the dev tools window open when you hit Ctrl+F5 it doesn't reload the cache. In IE there is a global setting in the dev tools that will make it redownload everything every time. In Firefox there is also a setting in the dev tools that will require it to download and not use the cache.
One way that you can test this, and how I test this, is by running Fiddler and watching if it does a full download of all your files or if it's caching.
From what I've experienced is that this is truly a browser caching issue and not anything to do with Azure.

Problem with Outlook plugin and webbrowser

I've created a couple of Office plugins. The plugin shows a set of html files installed on the clients computer. The plugin uses a COM-accessible assembly which shows a WinForm with a WebBrowser on it. The plugin makes the WebBrowser navigate to a file on the clients computer. The assembly is also used in other programs to show the same information.
When showing the local html files using a 'normal' browser (e.g. double clicking a file in Windows Explorer) the browser popup a security warning about running active content. This is because we have some javascript in it. This warning is supressed by setting the 'Allow active content to run in files on My Computer' in the Internet Explorer settings. This solves the issue using a 'normal' browser.
Funny enough the 'active content' warning is not shown when getting the same file using a Word/Excel/PowerPoint plugin. It calls the same assembly, using the same WinForm and using the same content. Despite the setting 'Allow active content to run from My Computer' being false, the content is shown without a warning and the javascript is executed.
Now, the problem and the real question is that Outlook does the reverse. No matter what I use for 'Allow active content to run from My Computer' the browser warning about the active content in the html file is shown. When I confirm the message and allow the scripts to continue, the javascript runs fine. So, even when I set the 'Allow active content to run from My Computer' to true, the warning is given.
I've gone through all (sort of) relevant settings in Outlook, but nothing helps.
I assume that Outlook is using some kind of private context for a webbrowser (probably because it is using a webbrowser object internally).
The real question is: how can I make the Outlook plugin respect the IE settings?
(I understand this is a long story and maybe not clear enough. Please let me know if I have to elaborate more).
I couldn't get rid of the security warning without lowering the security setting. And that is not an option: we are talking about a project that will be installed on millions of computers.
I decided to go another route. Let's see if we can make the browser trust the html pages. So, what to do to get rid of the 'Active content' warning.
First I investigated what exactly triggers the warning. That was easy: any tag in your html file will do. And I need script, so removing that isn't an option. But, when hosted from a website, the scripts run fine and don't suffer from a warning. So, I investigated if it is possible to run my files in the Internet-context.
I found out there is a way, at least for IE (which in my case is sufficient). If you save a webpage as a complete HTML file from IE, the browser adds a comment to the html to signal its origin. Something like: . If you later open that stored html file, the file is shown in the Internet context.
So, I tried adding to the html file. And, voila, the file is opened in the Internet context. The security warning about active content is gone and the scripts are executed fine.
But, that raised another problem. We have a couple of window.open statements in the scripts and using that causes he cross domain browsing problems that in recent IE versions are blocked. Even if you use a relative path in the window.open call, if fails and you end up with a blank window.
In our case, we can (probably) decide to get rid of the window.open calls. But, if a reader ever finds a solution for using window.open in this scenario, I would be very happy if you let me know.
So, for now: case closed...
Internet explorer use Mark of web in such cases
<!-- saved from url=(0014)about:internet -->
<!doctype html>
<!-- saved from url=(0023)http://www.contoso.com/ -->
<html>
<head>
<title>A Mark of the Web Example.</title>
</head>
<body>
<p>Hello, World</p>
</body>
</html>
More info from here
https://msdn.microsoft.com/en-us/library/ms537628(v=vs.85).aspx

CSS reload on IE7

It looks like IE7 doesn't reload the latest version of my stylesheet each time I upload a new version on the server.
This is annoying as I am debugging my .css file to make it work on IE...
Tried to empty the browser cache but still not working.
Thanks for your help.
Ctrl-F5 - forcible way to reload in IE
Include your version number in the file name. myfile_v1234.css
When testing, every time you do an update you can just wite "stylesheet.css?r=98123"
As long as the query string is different, it'll be downloaded again.
If you need, you can use javascript to append Math.random(), to get the random number. Not required on production though, when updates would be stable.
2 Questions:
Does IE eventually load with the newer stylesheet?
How are you saving the changes to the server (SSH, Web Interface, etc.)?
I ask because I ran into an issue with a web-based file management system a while back where one browser would show the CSS just fine, the other wouldn't, and we noticed the issue of which browser played nicely depended on which browser we used to upload the CSS.
The reason turned out to be that IE gave the CSS file a different MIME type than Firefox. If you continue to notice the issue even when you've cleared the cache, check the MIME type of the file using Firefox by going to Tools > Page Info.
Also, if it is simply a caching issue, consider turning caching off in IE. I believe this should be an Advanced Option under Internet Options.
Also, you may want to try creating a special developer environment for IE (if it comes down to it.) Perhaps have another machine with IE7 and no caching and any other features turned off (A kiosk mode, perhaps), and then previewing the page on that machine.
Thanks to you all!
I did manage to solve my problem with the "stupid" Ctrl+F5, and by changing the Internet Parameters of Windows to reload content every new visit.

Multiple swf files not loading in DNN 5.X

We have run numerous tests now and it has now come down to either a DNN-SWFObject loading multiple swf files on a page or Firefox bug.
Here's the outcome we need:
Two swf files on one page:
Header.swf: which holds the nav and some bling animation.
Map.swf: which has different provinces of the country highlighted on rollover. The active province is highlighted by reading the URL via Javascript and then loaded into the Map.swf via FlashVars.
In all of our other tests in other browsers, the scenario works very well but in Firefox 3.5.3 The swf files refuse to show.
We have stripped this test down to the bare minimum, one html page scenario and embedding it the same way using SWFObject 2.2 and this works in Firefox. When it is uploaded in DNN, the swf files refuse to show.
Is there anything anyone can think of?
Many thanks,
James
My first thought would be the way dnn renames element ids - and are you using client ids
If you could post some code it might help to look at it or a url to look at

Resources