Skip to content
Advertisement

Tag: javascript

Read Facebook Application Cookie from JavaScript?

(I’m fairly certain the answer to this question is quite simply “no” but I figured I’d ask in case anybody here has found a clever solution/workaround in the past.) Using the PHP code provided as an example for simple Facebook development, one can see how it reads in the cookie to get the necessary values to place in the JavaScript

How to trim a file extension from a String in JavaScript?

For example, assuming that x = filename.jpg, I want to get filename, where filename could be any file name (Let’s assume the file name only contains [a-zA-Z0-9-_] to simplify.). I saw x.substring(0, x.indexOf(‘.jpg’)) on DZone Snippets, but wouldn’t x.substring(0, x.length-4) perform better? Because, length is a property and doesn’t do character checking whereas indexOf() is a function and does character

Google API Key for Local Testing

Is there any way to get a Google API key for local testing purposes? I intend to use some of the Google APIs mainly for educational purposes (i.e For learning about it..) and I need to generate an API key without supplying a web site URL..Thanks in advance.. P.S: If it helps I’m trying to learn about Google Translate API

How to redirect to home page

How can I redirect a user to home page? Example: mywebsite.example/ddfdf/fdfdsf and I want to redirect to mywebsite.example However I want to do it without typing the static name. How can I do this? Answer

How to get the tag HTML with JavaScript / jQuery?

Using $(‘html’).html() I can get the HTML within the <html> tag (<head>, <body>, etc.). But how can I get the actual HTML of the <html> tag (with attributes)? Alternatively, is it possible to get the entire HTML of the page (including doctype, <html>, etc.) with jQuery (or plain old JavaScript)? Answer The simplest way to get the html element natively

Advertisement