0

It seems that the JS bookmarklet cannot get the current URL from the browser address bar if the page of URL is not loaded. I have tried the followings but not work. (in FF 19.0.2)

  1. window.location.href
  2. document.location.href
  3. self.location.toString()

Is is possible to load URL from bookmarklet without loading it?

northtree
  • 8,569
  • 11
  • 61
  • 80
  • You mean you want to call your bookmarklet when the user has just _typed in_ an URL, but has not clicked enter yet? I don’t think you can get that info as long as no document is actually loaded. – CBroe Mar 19 '13 at 09:20
  • @CBroe Yes, that's what i want. I need this feature to improve the productivity. – northtree Mar 19 '13 at 10:00
  • No ... this is not possible ... till recently, running a bookmarklet on a blank page (equivalent to about:blank) was possible where you could have (window.)prompted the user or tried something else (i believe even that wouldn't have solved your requirement anyways) ... but it doesn't work anymore ... now you need to load the page first and then the bookmarklet – webextensions.org Mar 20 '13 at 10:39
  • Not to mention, this method would have no way of working on platforms (e.g. chrome on android) where bookmarklets must be invoked by typing into the URL bar... – Michael Jan 13 '14 at 22:39

0 Answers0