Get the url of the website the user is about to open? - google-chrome

I am just developing an extension to kill time so I was wondering is it possible get the url of a website the person is about to open? like say suppose I open up a new tab and type in google.com. It is possible for me to get url as soon as I hit enter or go?

Related

How do I redirect a user to another page based on what the user has entered in the taskbar using Chrome Extension?

I am looking for a solution for the problem in the Chrome Extension.
If I enter some value in the URL like Mail, Notes, Profile, etc. I want to access the keywords before the values are accessed by the browser and then taken for a search which then changes the URL based on the default search engine.
I want to access the words and then automatically redirect the user to another page. I don't really know if it is possible or not, but thought of asking it to the community.
Or, Is there any way we can make some words which will not be searchable using the Address bar, but it should be that we don't need to make changes in the settings directly, but by using the extension.
Any kind of response are appreciated.
I was trying to capture the value that user enters in the Address bar. I found that we can actually find the link that upon searching from the address bar can be captured using Javascript but could not find if it was possible to capture before the search takes place. (immediately after pressing the enter key or search button).

record events & generate puppeteer script automatically, is it doable without chrome extension puppeteer-recorder?

Is below thing possible with puppeteer ?
e.g
i open http://localhost:3000 where one Html Form with URL is there.
if i enter url = "amazon.com" and press go then recording will automatic start ( event recording )
in new tab i just search product and add to cart it
then stop recording by visiting http://localhost:3000 page button
so one recording is saved with events
Now in this page all recording will be shown
And when i play "amazon.com" recording then it will run step number 2 to 3 automatically add product into cart
Pl. help me just want to know is it possible ?
I am able to run with static script but i need to create dynamic script each timeThanks in Advance
is it doable without chrome extension ?
Please help someone
is it doable ?

Save URL of redirected page

I have "hotspot". Then i connect it - it redirects me to login page.
If i have few opened tabs and click on it during auth - they are redirected to my hotspot application.
How to save url except as a GET param?
Application is complex so hard to track all urls changes and pass old url. And it is not pretty.
Something like window/tab storage.
Maybe is there window indentifier that i can save in local-storage or web-sql?
Window identificator can be saved in window.name. It saved across refreshes and urls changes.

Redirecting domain name to open an HTML page

I have a script that is being hosted on my Raspberry Pi over my local network.
I'm curious how I would go about being able to type in inventory in my web browser on my PC to be able to open up the HTML page that is generated by the script on my Raspberry Pi?
To elaborate, how would I have my browser to know at //pi/users/home/script/some.html when I type in inventory in the address bar? (Do I set this in my router or in a config file on my PC)
I think what you are looking for is the 'keyword' entry in a bookmark's properties.
You first create a bookmark of the webpage you want to link to. Then open the properties for that specific bookmark and enter the keyword of 'inventory'.
This way, every time you type in 'inventory' in your browser address bar, you will go to that page.

Auth redirect - opening a local HTML document in a new tab in a Firefox extension

I am currently trying to port a Chrome extension to Firefox.
The Chrome extension has a "Login" page, which is opened in a new tab as an HTML document. The HTML document is stored in the local directory with other extension files. The user inputs a URL which should represent a server running our application, where the user will be asked to login. After a successful login, the user is redirected back to the options.html page, which is updated to show the user's preferences.
I would like to duplicate this in the Firefox extension, i.e. I would love to avoid writing anything in XUL to build an options page.
I tried opening a new tab with my HTML page like this:
var url = "chrome://myextension/content/options.html";
var win = Components.classes['#mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator)
.getMostRecentWindow('navigator:browser');
win.gBrowser.selectedTab = win.gBrowser.addTab(url);
But I don't like this for a few reasons: 1) The navbar in the new tab displays the "chrome:// ..." URL, and 2) it breaks the authentication process. The authentication is done using an OAuth type system, and the current URL is passed into the API so that the user can be redirected back upon successful authentication. The authentication fails with "chrome://" as part of the URL.
Just out of curiosity, I tried hardcoding the URL like this:
http://myextension/content/options.html
And the user is actually successfully authenticated, but then the redirect obviously fails afterward.
The Chrome extension seems to work with no problems or weird hacks. From what I can tell, opening it works like this:
chrome.tabs.create({"url":chrome.extension.getURL("options.html"), "selected":true});
And referencing the URL of the tab later so we can be redirected back to it just works like this:
var options_url = chrome.extension.getURL('options.html');
So, I'm wondering: what is the best way to open a local HTML document in a new tab with a Firefox extension, without using the "chrome://" "protocol"? Is there a similar way to how it can be done with Google Chrome extensions?
UPDATE 23/5/12
So this article says that chrome:// URLs are not accessible from the web, only locally.
http://adblockplus.org/blog/web-pages-accessing-chrome-is-forbidden
I think this could be the reason why my authentication was failing. I'm definitely looking for a way for my extension to display a local HTML file in a window or tab without using chrome://.
UPDATE 07/6/12
Here is my (hopefully temporary) solution:
The user enters the URL of the server running our application. He/she is redirected to the application login page, but instead of passing "chrome://myextension/content/options.html" as the URL to be redirected back to after authentication, I pass a phony URL, i.e. "http://myextension/thisis/madeup.html".
In my extension's overlay.js, I set up an HTTP request listener which listens for the phony URL being requested. When a GET happens for the phony URL, I cancel the request, and open the real, locally stored page at "chrome://myextension/content/options.html".
See the following references:
https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIObserver
https://developer.mozilla.org/en/XUL_School/Intercepting_Page_Loads#HTTP_Observers
If you're trying to do this redirect for an OAuth call you should try using OAuthorizer from Mozilla instead of doing the redirect work yourself. Hope that helps!