0

I want to run a function in a chrome extension while the user is typing a url. The best option is to run the function on every key pressed on typing the url.

Any ideas?

  • Err do you have any code to show already? You need to post what you have tried. jsfiddle would be a good place for this. – lharby May 13 '15 at 08:20
  • The best approach for this that I know is a content script. However a content script runs when a new page is loaded. What I want is to call a function while the user is stil typing a url. Unfortunately there is no code yet – Giannis Tzagarakis May 13 '15 at 08:23
  • see here: http://stackoverflow.com/a/18640449/1238244 You can write a function to run if someone is typing in a form field. But the address bar is outside of the document. Although I don't know if there is more flexibility with a chrome extensions. – lharby May 13 '15 at 08:25
  • I had a quick look here too: http://stackoverflow.com/search?q=%5Bgoogle-chrome-extension%5D+function+address+bar – lharby May 13 '15 at 08:31
  • @lharby Never suggest jsfiddle as a good place to post code for SO. [This is specifically discouraged](http://meta.stackexchange.com/questions/149890/prevent-posts-with-links-to-jsfiddle-and-no-code). Relevant code must be present in the question itself - jsfiddle can only be a secondary tool to demonstrate. – Xan May 13 '15 at 09:17
  • @Xan ok thanks for that. I do really like jsfiddle (prefer it to the code generator on SO) but I take your point. I was asking for code to be shown in the question. – lharby May 13 '15 at 09:36
  • 1
    @lharby Oh, don't get me wrong, SO's snippet mechanism is _bad_. It's just important to emphasize that code but be _also_ present in the question if you're using a fiddle. – Xan May 13 '15 at 09:37
  • Very unlikely that you will achieve this. You can detect changes on a page but not in the address bar. – Zig Mandel May 13 '15 at 12:37

0 Answers0