MathJax enabled on page interferes with Rocket Loader - mathjax

I am using cloudflare as cdn service (Free). But when i use mathjax on any page it causes problem with rocket loader enabled.
Here is the link : http://www.e4exam.com/Questions/profit-and-loss
I am getting this when i enabled Rocket Loader
But when i disabled rocket loader it is ok.
So is there any way to use MathJax with Rocket Loader enabled.

The rocket.js file that Rocket Loader uses apparently replaces <script> tags in your page with its own object class, but this is not implemented in a way that is fully compatible with the native browser implementations. MathJax uses <script> tags to store the math internally in the page, and these differences in implementation trip up MathJax.
One solution apparently is to add data-cfasync="false" to the <script> that loads MathJax.js (see this MathJax issue tracker for details).

Related

Namespace RequireJS in JS API to avoid conflicts with 3rd party AMD libraries

I want to include jquery and jquery UI along with requirejs( at top of the header ).
with WordPress starting to utillize dynamic module loading and React, primarily in its administrative dashboard and content editing experience, this became impossible. I am experiencing constant issues where dynamically loaded jQuery UI components are being picked up by RequireJS which attempts to load them within its own scope. Under this condition, RequireJS fails and jQuery UI does not load in the global scope as expected.
this is the exact issue check console on your local
Console screenshot
can anyone solve it? thanks in advance!..
<script src='http://requirejs.org/docs/release/2.1.18/minified/require.js'></script>
<script src='http://code.jquery.com/jquery-1.11.3.min.js'></script>
<script src='http://code.jquery.com/ui/1.11.4/jquery-ui.min.js'></script>

MathJax with Node partials

I'm using Node and Express with MathJax to make a comment system with TeX. The problem is, the TeX is only rendered when the page first loads, or when I refresh the page, but does not load when rendering a partial. Any advice?
Thanks.
See the MathJax documentation on dynamic pages, which will suggest that you use
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
after adding math to the page.
Also, you could check out the MathJax-node project, which implements APIs for interacting with MathJax through node.js programs.

Porting to WinJS without modifying libraries

Is there a way to port existing HTML5 apps to WinJS without modifying libraries? Going through each library and wrapping innerHTML calls with execUnsafeLocalFunction is such a dirty hack.
Could I load the base page as unsafe some how? Loading everything in an iframe is just displaying an empty white box.
You should be able to make things work with an iframe if you put it in the right context with ms-appx-web:
<iframe src="ms-appx-web:///path/to/iframe.html"></iframe>
The downside is you won't be able to get at WinRT APIs from there. Unfortunately there isn't a way to selectively disable parts of SafeHTML. While you could globally disable it by doing some hacks to replace HTMLElement.innerHTML so that it calls execUnsafeLocalFunction implicitly, that would also open you up to script injection attacks which could cause your app to be rejected from the store.
Another option is to actually navigate the root page into the web context:
window.location.href = "ms-appx-web:///path/to/iframe.html";
I believe you then may be able to have an invisible iframe back to the local context (ms-appx) and use the postMessage API to communicate across the boundary as needed.

what browser plugin that lets you override html of a website automatically

Can anyone suggest a browser plugin that will let me override a website whenever I am loading a particular website.
Example Scenario:
Whenever I load yahoo.com I want to change on how it renders the html and behave.
It needs to be able to manipulate the DOM. example, it can change the attribute of an <img height="" width="" />, example the width and height of the image.
Aside from changing attributes it also need to be able to inject new elements. example i can insert new <divs> or <p>.
I also need to be able to manipulate the head tag as I like to insert external CSS and JS for the overrides.
I primarily use Google Chrome and Mozilla Firefox.
Thank You.
Chrome has native support and Firefox via a plugin for user scripts (also called greasemonkey scripts). They are essentially javascript files that are installed like an extension. At the top you define the domains for your script to run on and you have access to modify the DOM. There are lots of examples at http://userscripts.org/ . Load a few in chrome and then take a look at the user.js file source to see how they work.
You could also do it via a Bookmarklet, however they are more of a hack compared to Greasemonkey scripts
It's called the content scripts in Chrome extension.

How should I go about rendering a webpage without using a browser?

Basically I am currently doing some research, and I am interested to find out how I could render web pages without a browser: I have some algorithms that I would like to run to calculate the visual aspect of each blocks of DOM node(s) for each page.
What you're asking for basically, is a browser rendering engine, otherwise known as a layout engine... For example, Firefox uses the Gecko layout engine to render the pages. Theoretically, you could adopt this engine for whatever project you're working on, saving you a lot of time.
The Gecko engine is used in more projects than just Firefox, and since it's open source, you could easily get the source code and try to throw it in an application.
Wikipedia has a nice list of layout engines, so there are other alternatives to Gecko, like GtkHTML.
Basically, you want to create the data structures a browser internally creates so that it knows how to render the page.
Check out the Firefox source.
I suspect it's rather complex.

Resources