Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

chrome-extension:// links open about:blank

I've recently been contributing to the Enhanced Steam extension and I've found that a link fetched with chrome.extension.getURL simply opens about:blank and not the link described.

I do not believe it's actually a problem with the extension, but rather a problem in chrome. The link it supplies is valid (chrome-extension://pimjhgjngccknempdnehdeaihcjbajod/options.html) and navigating directly works correctly.

I tried chrome.tabs.create, but found that I am not allowed to use it due to the script modifying pre-existing content.

Any help or work arounds would be appreciated.

like image 342
Smashman Avatar asked Nov 16 '13 14:11

Smashman


People also ask

How do I get rid of about blank on Google Chrome?

How Do I Get Rid Of “About Blank” On Google Chrome? Go to the menu > Settings in Google Chrome. Select “Open the New Tab page” from the “On startup” column, delete About Blank from the web pages that start on startup, and choose your favorite web page.

Why do I get an about blank page?

If you see “about:blank” in your web browser's address bar, you're viewing an empty page built into your web browser. It's a part of Google Chrome, Mozilla Firefox, Apple Safari, Microsoft Edge, Internet Explorer, and other browsers. There's nothing wrong with about:blank.

How do I fix this about blank blocked?

Perhaps it was displaying a page provided by the malware which, once removed, leaves the browser nothing to display. The browser must display something, so it displays about:blank. The solution is simple: change your homepage back to what you want it to be.


2 Answers

I put all my required files into "web_accessible_resources", it solved my problem. See this in #4 https://bugs.chromium.org/p/chromium/issues/detail?id=310870#c4

It is Chrome's previous problem which is not secure. In build 31.0.1650.57, Chrome fixed this which is to force to put required files in "web_accessible_resources". In Chrome extension, lots of samples don't use "web_accessible_resources", those are the bugs, those samples will have this "chrome-extension:// links open about:blank" problem in build 31.0.1650.57.

Actually my chrome extension MarkView was facing this issue and I had to update its manifest.json to make it work for this Chrome update. By the way, MarkView is tool to read and write Awesome Markdown Files, it provides features including Content Outline, Sortable Tables and code block syntax highlight with line number.

like image 115
swcool Avatar answered Sep 22 '22 02:09

swcool


Looks like a bug in Chrome to me. If you don't have too many pages like this to change then could you try using message passing to pass the page you want to open to the background page? Then use either window.open or chrome.tabs.create within the background page. Example code shown below:

//CONTENT SCRIPT

chrome.runtime.sendMessage({greeting: "OpenPage", filename:"somepage.html", querystring:"?aValue="+someVal}, function(response) {});

Then in your Background page

//BACKGROUND PAGE

chrome.runtime.onMessage.addListener(
  function(request, sender, sendResponse) {  
 if (request.greeting == "OpenPage"){
  open_page(request.filename, request.querystring)
 }

  });


function open_page(filename, querystring){

var pageUrl = chrome.extension.getURL(filename)+querystring;

chrome.tabs.create({'url': pageUrl }, function(tab) {
  // Tab opened.
});
}
like image 34
Paulie Avatar answered Sep 23 '22 02:09

Paulie