I am attempting to learn Modernizr (or how to use it I should say) and seem to be stuck.
I want to fire a script if the browser does not support CSS3 Animations
I have modernizr set to check for css animations and I have this script (at the bottom of the page):
if (Modernizr.cssanimations) {
//Script to Run
}
When I open Firefox (which supports CSS3 Animations) the script fires. When I open IE (which does not support CSS3 Animations) the script does not fire.
What do I have wrong here?
Modernizr's flags tell you whether the feature is supported. So your if statement is saying "if CSS animations are supported, then do stuff." That's exactly the opposite of what you said you wanted -- you want to do stuff if CSS animations are not supported.
Do this instead:
if (!Modernizr.cssanimations) {
//Script to Run
}
In your case, you should either use a ! before Modernizr.cssanimations
or use an else statement.
Related
I know no java or any other language besides c#, so how would I try to make it a popup chrome extension that you can play in your browser.
Maybe you can read this: https://developer.chrome.com/docs/extensions/mv3/getstarted/
I'm pretty sure that in Unity, you can build an application as WebGL. You can read this if you want: https://docs.unity3d.com/Manual/webgl-building.html
Then, you can put the code they give you for the WebGL and put it inside the extensions HTML, and then I think it'll work.
Have a pluggin that is installed as part of an app, the pluggin needs to use different overlays depending on what version of FF is being used as it modifies the interface.
I found https://developer.mozilla.org/en/Bundles to specify different files but this only seems to cover which OS/bitness.
Is there a way to specify that an overlay only applies to particular versions of the UI?
ie. This works for FF3.6 and earlier but breaks FF4
<overlay id="myOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<dialog id="commonDialog" onload="commonDialogOnLoad(); myLoad();"
ondialogaccept="myAccept(); return commonDialogOnAccept();">
This is aimed at the Domain Login and the FTP Login dialogs, so an idea on making it more specific could help too.
I haven't done this myself, but I think you can accomplish this effect using flags in your chrome.manifest file. See https://developer.mozilla.org/en/Chrome_Registration#Manifest_flags
Technically, the answer by MatrixFrog is correct, you can use flags in your chrome.manifest file. However, you better consider the fact that your code breaks Firefox 4 a warning - this approach should not be used, it is likely to break browser functionality. Also, what if a second extension tries to do the same thing? You should extend built-in functionality, not overwrite it. Your goal is apparently to run your own code when the common dialog loads. Please consider the following approach:
<overlay id="myOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="text/javascript"><![CDATA[
window.addEventListener("load", function()
{
// Your code here
}, false);
]]></script>
</overlay>
This solves two problems. For one, you no longer need to override the existing handler for the "load" event - addEventListener allows registering as many event handlers as you want, unlike onload attribute/property. The other problem: you were adding a function myLoad() to the global namespace of the common dialog. If Firefox code or some other extension decides to use the same function name in future there will be trouble. The code above completely avoids this problem by using an anonymous function - there can be no naming conflicts.
What command-line utility renders HTML as Firefox would, creating a
static image, without actually running Firefox and xwd (or ScreenGrab,
etc)?
Since all of Firefox's rendering libraries are open source, I'm
assuming someone's written something like this? It would be very
useful.
I realize static images can't have Flash animation (animated GIF/PNG
notwithstanding), JavaScript, etc, so I'm just looking for something
that renders plain HTML.
html2ps is worth a try, although it does not seem to use the css style sheets. This is a serious limitation.
On Debian/Ubuntu, it is provided as a package, so the classical sudo apt-get install html2ps will be fine.
(I know this has been given in the comments, but for the future reader, I thought it might be easier to find as an answer.)
You could write a small script which simply runs firefox using the command line options does a screen-shot, then closes firefox. Should only be about 3 lines of code to get started.
firefox -url http://mysite.com/homepage.php
https://developer.mozilla.org/en/Command_Line_Options
I am writing a Firefox extension which creates a Java applet in the page.
function addApplet(aDocument,url,classfile,archive) {
if (navigator.javaEnabled()) {
var anApplet,body;
body = aDocument.getElementsByTagName('body')[0];
anApplet = aDocument.createElement('applet');
anApplet.setAttribute('CODEBASE',url);
anApplet.setAttribute('code',classfile);
anApplet.setAttribute('archive',archive);
anApplet.setAttribute('name',"Applet");
anApplet.setAttribute('width',"0");
anApplet.setAttribute('height',"0");
body.appendChild(anApplet);
}
}
The JAR file loaded from the applet is 500KB in size. I noticed that sometimes the extension causes Firefox's vertical scrollbar to freeze and the hot-keys to stop working. The scroll-bar and hot-keys work fine if I prevent the extension to append the applet to the page.
Another weird behavior is -- on the frozen page if I click inside any text/search box or even address bar the scroller and the hotkeys begin to work again. The same thing happens if I switch tabs or minimize the browser window.
I am using Firefox 3.6.12 on WindowsXP.
Please help me if you have an idea regarding this or if I should provide more information.
(Hey guys this problem is still not solved....please help me out with this......)
Thanks
See if something similar happens if you load the applet from an html page that includes the tag and its children as static content, rather than content added to the DOM.
I imagine it's a problem of Firefox and java, not your code.
Applets can be tricky. I would suggest creating a page of pure HTML that works, first.
As far as suggestions for change go, 1st thing to change is the width/height of the applet. An applet with 0 size can cause all sorts of problems. Instead, give it a WxH of 20 (then later hide it using CSS).
Ok this has worked:
Solution:
This behavior is the default since JDK 1.3. However you might need to prevent the applet from getting focus on startup, for example, if your applet is invisible and does not require focus at all. In this case, you can set to false the special parameter initial_focus in the HTML tag, as follows:
<applet code="MyApplet" width=50 height=50>
*<param name=initial_focus value="false">*</applet>
Cheers,
I have modified some code inside my Firefox. Just add on some extra functions for my isolation network. Besides that I also want to create my own FF extension for this particular purpose. I just need some information:
Can the code inside my Firefox, call any function Javascript declared in my extension?
Generally yes, but your question is not specific enough. Both Firefox and an extension can have JS and C code, code in XPCOM components, code running in a specific window, JS modules, etc.
Assuming the "Firefox code" is running in some window (e.g. you edit browser.js) and the "extension function" you want to call also exists in that window (e.g. you overlay chrome://browser/content/browser.xul, which is the URI of the main Firefox window, in which the browser.js code runs), you can just call it as you would normally do.