I can't find anything googling. How can I extract search engine keywords for traffic sent to my website using javascript?
I don't want to reinvent the wheel, I'm looking for something that already exists, a tested library, however I can't find it.
As an answer, rather than just a comment. Your javascript code will need to inspect document.referrer (This may have been the magic keyword missing from your search).
Different search engines use different parameter names for the query, so you will need to know what to look for. Google uses q Yahoo! appear to use pqstr. Look for the value of that parameter in the referring url, and unencode it (with unencodeURIComponent).
However, there is still this answer to check out.
Related
I have a textarea that is defined thus:
<textarea spellcheck="true"></textarea>
When users type, spelling mistakes are highlighted to them (using a red underline, for my browser). Is there any way (using jQuery) to check whether there are spelling mistakes before a user submits the form?
This is what I want to achieve:
Form input textarea: [Typing some text in thsi box] [submit]
Before the user clicks submit, I would like a listener to "catch" the fact that "thsi" was spelled incorrectly and prompt the user. Is there any way to do this via the html5 spellcheck method, or do I have to use a custom javascript function for the spellchecking and listening?
A quick search brought up this jQuery plug-in that seems to do exactly what you want and it uses the Google spell-checking API https://code.google.com/p/jquery-spellchecker/wiki/Documentation
There is also Typo.js https://github.com/cfinke/Typo.js, which is a client-side based library. It does not use any API, instead it uses Hunspell-style dictionaries and it is only available for American English "EN_US".
If you don't want to use a plug-in or an existing code snippet, you can build your own by sending an ajax request to check the typed text against a service provider (Google in this case).
you can use jquery plugin for checking spelling.
i hope it helps you, thanks.
JavaScript SpellCheck
http://www.javascriptspellcheck.com/
If you have to build it natively you might consider building a Trie datastructure for this
check this Trie reference 1
Trie reference 2
Hope this helps
You have different ways to achieve it, it depends if your spelling has to be focused on a subject (like medical word spelling) or is it general.
Create yourself a dictionary (not the best choice and too long to make)
make a query to online dictionaries like google
try Jspell Evolution (the installation is a little annoying but once done it works very well Jspell Evolution website
you can look at typo.js typo.js article
Yesterday I found this article that is 10 times better than the others :
Article for javascript spell check locales where you can also have spelling for other languages/locales and not only english locale.
I was wondering if there's a Javascript equivalent to the Lucene API, designed to be used on client side to index a relatively small data set.
An example use case would be a static site (generated for instance) with the ability to search content without server side processing.
I've found this : http://lunrjs.com/ It looks like what I'm searching for but doesn't seem to support fuzzy searches.
Theoretically, you could use Search-index in conjunction with node-browserify or another similar hack. Practically, I doubt this effort is worth pursuing.
You also have search-index as #mindas mentions. Lunr is more mature, and easier to get up and runnig, but search-index is maybe more feature rich? As with lunr, you'll need to do stemming on the data you want to index and/or use the matcher. The matcher does prefix search and returns words and/or phrases that is present in your document index.
I'm biased, but I think it's now wort the effort to use search-index. There are now some examples on how to use it client side with browserify.
Before anyone jumps in and says, "Oh!! that's a bad idea", I know it is.
I want to keep both the key and value in the query string to be not easily visible to the end user.
I have something like this google.com/?category=textile&user=user1
I need to make it unintelligible like this: google.com/?kasjdhfkashasdfsf32423
Is there any way to achieve this in javascript. I have already seen this
I have already seen this
and this.
but I don't think encoding will solve the problem. Also, this code is entirely in client side. I know that it is not secure but I just need this is a naive, weak defense.
Please help.
Edit
I apologize if my question was not clear earlier.
The URL google.com/?category=textile&user=user1 is being passed on from a different application.
The values passed in the query string directly controls what is being displayed to the user. As is, anyone with no technical knowledge can easily change the value and view the data corresponding to a different category or user. I need to make this unintelligible so that it is not obvious. If a user is a techie and figures out the encryption used, then it is fine. I need a stop-gap solution till we have a better architecture in place
You can use base64. Javascript has native functions to do that :
alert(btoa("category=textile&user=user1")); // ==> Y2F0ZWdvcnk9dGV4dGlsZSZ1c2VyPXVzZXIx
and to reverse it :
alert(atob("Y2F0ZWdvcnk9dGV4dGlsZSZ1c2VyPXVzZXIx")); // ==> category=textile&user=user1
Be careful to read the doc if you have unicode strings, it's a little different : https://developer.mozilla.org/en-US/docs/Web/API/Window.btoa
If you don't looking for serious strong crypto, you can use ROT13:
http://en.wikipedia.org/wiki/ROT13
This is enough for slightly obfuscate keys/values in the your URLs.
I try to adapt etherpad so it is only accessible if certain params are sent with the request.
For example I want a certain pad just to be displayed if there is a unique id provided like
http://myetherpad.com/thepadid?myparam=blub
Does anyone know where exactly I can parse the params? I searched all the js-files but didn't find exactly what I am looking for.
I found out that there is some kind of request object. You can access it like
request.params.padId
But I also don't know where to search for the implementation of this object.
I hope somebody can help me. Thanks :)
You could probably hack something into the code at https://github.com/ether/pad/blob/master/etherpad/src/etherpad/licensing.js#L153
But if all you need is some kind of password protection, there are easier ways. The easiest would be to use something that is built in to your web server, or to use the built-in pro functionality -- more on that on http://etherpad.org/2010/10/14/241/
(Your idea with using URL-parameters for password could be simplified; just use a complicated pad name and only those with the URL will find it. Having a "nice" pad name and adding a complicated password at the end doesn't protect the pad at all.)
For anyone with the same problem: You can get the GET-parameters via
request.headers['Referer']
It returns the URI the user called. But I still don't know how to do it properly (or get the POST parameters).
does Google index content generated using javascript I'm using this function to write the text
document.write(String.fromCharCode(...))
something like that
document.write(String.fromCharCode(60,112,62,65,100,100,32,100,101,115,99,114,105,112,116,105,111,110,32,102,111,114,32,121,111,117,114,32,65,114,116,105,99,108,101,32,102,114,111,109,32,104,101,114,101,46,60,47,112,62,10));
and if Google don't index javascript will it regard this code as malicious as this function is also used to generate malicious javascript codes of course I'm not using malicious
Thanks in advance.
Yes/No
Google WILL index content if you give it some hints. For example, you'd need to use the #! format and your URLs need to resolve WITHOUT the #!. Like Twitter:
http://twitter.com#!/oscargodson and http://twitter.com/oscargodson work. Google sees a link to the first link then forwards onto the second.
For random bits of JS though? Most likely not. Google doesn't give out specific details to their algorithm. They have quitely switched to indexing PDFs, Flash, Docs, and more when before they said they didn't. With the rise of JS, i wouldn't be surprised if they officially did tho sometime soon.
Here are Google's docs on it:
http://code.google.com/web/ajaxcrawling/
Yes. As of May of 2014, they publicized their move.
http://googlewebmastercentral.blogspot.com.es/2014/05/understanding-web-pages-better.html