Skip to content
Advertisement

How to prevent IFRAME from redirecting top-level window

Some websites have code to “break out” of IFRAME enclosures, meaning that if a page A is loaded as an IFRAME inside an parent page P some Javascript in A redirects the outer window to A. Typically this Javascript looks something like this: My question is: As the author of the parent page P and not being the author of

Determine when an user is typing

I am building a search box (input field) which should make a server call to filter a grid with the text being inserted on it but I need to make this in an smart way, I need to fire the server call only if the user has stopped. Right now I’m trying to implement it, but if someone knows how

How to append something to an array?

This question’s answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions. How do I append an object (such as a string or number) to an array in JavaScript? Answer Use the Array.prototype.push method to append values to the end of an array: You can use the push() function

Avoiding a Javascript race condition

My users are presented a basically a stripped down version of a spreadsheet. There are textboxes in each row in the grid. When they change a value in a textbox, I’m performing validation on their input, updating the collection that’s driving the grid, and redrawing the subtotals on the page. This is all handled by the OnChange event of each

Get the name of an object’s type

Is there a JavaScript equivalent of Java’s class.getName()? Answer Is there a JavaScript equivalent of Java’s class.getName()? No. ES2015 Update: the name of class Foo {} is Foo.name. The name of thing’s class, regardless of thing’s type, is thing.constructor.name. Builtin constructors in an ES2015 environment have the correct name property; for instance (2).constructor.name is “Number”. But here are various hacks

caching JavaScript files

Which is the best method to make the browser use cached versions of js files (from the serverside)? Answer Have a look at Yahoo! tips: https://developer.yahoo.com/performance/rules.html#expires. There are also tips by Google: https://developers.google.com/speed/docs/insights/LeverageBrowserCaching

What is JavaScript’s highest integer value that a number can go to without losing precision?

Is this defined by the language? Is there a defined maximum? Is it different in different browsers? Answer JavaScript has two number types: Number and BigInt. The most frequently-used number type, Number, is a 64-bit floating point IEEE 754 number. The largest exact integral value of this type is Number.MAX_SAFE_INTEGER, which is: 253-1, or +/- 9,007,199,254,740,991, or nine quadrillion seven

Advertisement