How to open a page with information about the browser? - javascript

Is it possible via window.open to open a page with information about the version of the browser? My browser is Google Chrome.
window.open("chrome://version/");
This code opens a new tab "about:blank".

You cannot use any of the usual APIs from the Web platform to open chrome:// pages.
These pages can be opened using chrome.tabs.create though:
chrome.tabs.create({
url: 'chrome://version'
});

You're not allowed to do this (security reason, probably):
Try typing that in the console:
window.location.href = "chrome://version/"
output: Not allowed to load local resource: chrome://version/

Related

how to make chrome extension with options that allow you to open settings of chrome in new tab?

today i'm facing problem that i can't solve my problem is very simple i wanted to make
chrome extension that allow me to do some easy steps exomple i wanted to open chrome setting
in new tab with my extension i did setting botton in the extension and the clear browser data
and open extension of chrome but when i try to open it when i click nothing happen it keep
give me this error =
Not allowed to load local resource: chrome://settings/
and my code is this =
<div class="flex"><i class="fas fa-cogs" style="color:darksalmon "></i></div>
please help me to solve this error please and thank you very much
You cannot use the standard HTML anchor to open an internal Chrome link. Chrome’s links are not valid navigation protocols, only these are:
Website
Email
Telephone
Document Section
JavaScript
For a internal Chrome link you should open a new tab and pass the internal link to it via the Tab API...
https://developer.chrome.com/extensions/tabs
Use the function "create"...
chrome.tabs.create({'url':'chrome://settings/','selected':true}, function(tab){
/// Whatever else goes in here...
});

How to open a tab to a file:/// URL Firefox extension developement?

I don't know much about JavaScript. I am trying to open a tab with a file URL and it keeps reverting to the about:newtab page. Is it possible to open a file URL in Firefox extension?
Currently I am using:
var updating = browser.tabs.update(tab.id, { url: result.data.url });
updating.then(onUpdated, onError);
Where result.data.url is a file URL. It works with HTTP and HTTPS URL.
I am using Firefox 56.0.1
Currently it's not possible. You can follow bug https://bugzilla.mozilla.org/show_bug.cgi?id=1266960 to stay up to date.

Userscript open a client side generated page

I'm writing a userscript which will generate a web page client side and open to view it.
What I want:
Open a page with specified content generated by the userscript
It should work on recently Firefox with Violentmonkey
What I'm trying:
convert generated page to data: or blob: url and then open it by window.open / GM_openInTab.
What is wrong:
window.open(myUrl):
Adblock Plus with EasyList dislike this. It will close pages with data: or blob: url automatically.
GM_openInTab(myUrl) aka chrome.tabs.create({ url: myUrl }):
Firefox disallow it at all. Trying to open a tab with data: or blob: url will simply do nothing.
Notes: Userscript is a page script (injected script) from extension. Userscript host (like Violentmonkey) will post message to backend script and call web extension api with backend script.
I don't want use a server for this issue, since I don't want anyone collect user info from the network request.
So, What should I do now?

onInstalled chrome runtime debugging?

chrome.runtime.onInstalled.addListener(function(){
chrome.tabs.update(null, {url: ''});
alert();
});
Above code doesn't work when I install my extension in developer mode. I want to update the active tab to be a blank tab once my extension installed in chrome web store.
That's an invalid URL, that's why it does not work.
You can't just "erase" the URL without navigating to what you supply as the new URL.
If you are trying to navigate to the New Tab page, it has a URL (that's normally hidden) chrome://newtab. If you want a blank page in terms of content, it's about:blank.

How to redirect url chrome-extension?

I'm using Google Developer Console and Oauth to develop a chrome extension so that user can login by google account.But I can not redirect to url like this
chrome-extension://<id>.
So how can this be solved ?
I know this is an older question, but I wondered too. You have to use the built in chrome API for accessing your extension's HTML.
chrome.extension.getURL('options.html')
Send redirect url from a content script to a background page:
chrome.extension.sendRequest({redirect: "http://redirect"});
In a background page update tab's url which would cause redirect:
chrome.extension.onRequest.addListener(function(request, sender) {
chrome.tabs.update(sender.tab.id, {url: request.redirect});
});
Refer: How do I redirect to a URL using a Google Chrome Extension & Content Script?

Categories