I'm really new to the chrome app dev part. I want to know how can I make a chrome application that will read my current URL and redirect me to another.
For instance if I am on www.stackoverflow.com and user clicks on the extension icon then it will redirect him to wwww.stackoverflow**NEW**.com
Thank you..
Follow these steps and you will be good.
Create a background script and define an entry for background script in manifest.json
In background script, define a handler on chrome.browserAction.onClicked.
Inside that handler, extract the url of current tab and check if it is the expected url, then just change the url of that tab.
Related
I am trying to prefill a website form and get the URL. I was able to find the varaible name using Chrome developer tool. For example, the one in the image is "app_email". However, when I change the URL accoridng to the instructions and reopen with the new URL, the form is not prefilled. Is there any suggestions? Thanks
I tried to edit the URL as stated above
Is there a way to dynamically include clipboard content into a URL of a Bookmark / Bookmarklet in Chrome?
For example, i copy a story number ("test-1234") and want to open it in jira, it would be helpful i could just click the bookmark, something like this:
https://jira.mydomain.com/browse/{clipboardContent}
and it would open the URL:
https://jira.mydomain.com/browse/test-1234
Or is there a chrome-extension that would make it possible?
With chrome.contexMenu API you can select any text ("test-1234") from any web page
and activate a function (present in the contextual menu)
that opens a new tab (or window) with an URL constructed by the fixed part and the parameter in the queue.
You have to grant "contextMenu" and "activeTab" in your manifest.
For further details please read: https://developer.chrome.com/docs/extensions/reference/contextMenus/
I'm doing since years exactly what you've described, but I'm on MacOS and for this I'm using Alfred App (https://www.alfredapp.com). I've created an own Workflow for this. If you're on WIN, then there is something which could be similar to Alfred App --> https://github.com/Wox-launcher/Wox
I am learning HTML, and whenever I execute the href function in HTML and click the blue text, the browser tries to redirect me to a folder inside my computer, when in reality I want to enter a website. For example, if I try to execute the following code, instead of the browser redirecting me to duckduckgo.com, it tries to redirect me to a folder inside my computer:
Browse anonymously and without being traced
How can I solve this issue?
Because href="duckduckgo.com" is using a relative URL, so the browser is looking for duckduckgo.com relative to the current URL that is displaying the page. To the browser it's no different than if you used href="index.html", both are structurally identical.
Instead, use a fully-qualified URL:
Browse anonymously and without being traced
You can also default to the current protocol with this:
Browse anonymously and without being traced
So if the current page is open via http:// or https:// then the link would use the same in the resulting request. Note however that your description of "a folder inside my computer" may somewhat imply that your current protocol could be file://, in which case an inferred protocol clearly wouldn't work. The point is, the structure of a complete URL is pretty versatile so you have options.
I'm writing a download manager app for Linux so I use a chrome extension to add listener to all download links in page and and when a download link clicked link send to a native app. everything is ok but I want to prevent show default chrome save dialog when download links clicked . how? thank you.
A quite limited approach to intercept single-clicked links would be to inject a content script with:
window.addEventListener("mousedown", interceptFunction); // intercept mouseclicks
window.addEventListener("keydown", interceptFunction); // intercept Enter key on a link
The interceptFunction would check if the link is likely to be a downloadable file judging by the url (file extension) and cancel the event:
event.preventDefault();
event.stopPropagation();
event.stopImmediatePropagation();
Then it would send the url to your background page which will tell your native app to start the download.
To make the decision whether to download or not more reliable you may perform a XMLHttpRequest with method: "HEAD" and analyze the response headers (you'll have to deal with CORS though) like Content-Disposition: attachment; filename=<file name.ext> and others.
I am very new (started today) to writing chrome extensions but need to write a 'fairly simple' one for tomorrow...
I am really struggling to get my head round it though!
I need to write an extension that opens a new tab or window (whichever is easier!) directed at a predefined url is opened when a certain URL is searched in the current.
An example of this would be if the user typed in www.facebook.com I am trying to get the extension to then open a new tab/window with www.google.com in.
Any help would be much appreciated!
Thanks
Will
In your html of the extension you can specify an anchor tag for the action button which opens a new tab like this
content of the anchor
or if you want to do it programmatically you can
window.open('http://google.com','_newtab');
You cant get at the contents of the omnibox unless you use the omnibox api, which means they have to specify your keyword first before your extension can get at the contents. You could make it open another page once they have gone to a url. You could use a content script that has a matches field that matches the page your interested in and then open a page accordingly.
Content Scripts
http://code.google.com/chrome/extensions/content_scripts.html
Tabs
You can use the tab api to get the current tabs details if your not in a content script. If you are in a content script you can use window.location as stated by Encore PTL. You can also use the tab api to open a tab.
http://code.google.com/chrome/extensions/tabs.html