So I'm kind of new to making extensions so I want to start with a simple one. Well I thought it wasn't too hard but I can't make my extension open new tab pages in incognito and in normal.
POPUP PAGE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href='style.css' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
function Tabs() {
chrome.browserAction.onClicked.addListener(function() {
chrome.tabs.create({'url': "http://www.google.com"});
});
}
</script>
<base target="_blank">
</head>
<body>
<div id="Google">
<a href="google.nl"><input type="submit" onClick="Tabs" class="btn search-submit" value="Google"> </a>
</div>
<div id="Google">
<form action="websitelink" method="get" target="_blank">
<input type="submit" class="btn search-submit" value="website1">
</form>
</div>
<div id="Twitter">
<form action="websitelink" method="get"target="_blank">
<input type="submit" class="btn search-submit" value="website2">
</form>
</div>
<div id="Youtube">
<form action="websitelink" method="get"target="_blank">
<input type="submit" class="btn search-submit" value="website3">
</form>
</div>
</body>
</html>
My Manifest File:
{
"name": "My Helper",
"version": "1.0",
"description": "My Helper",
"manifest_version": 2,
"browser_action": {
"default_icon": "icon128.png",
"default_title": "EXTENSTION DESCRIPTION",
"default_popup": "extension.html"
},
"permissions":
["tabs"]
}
The only thing I'm trying to do is opening a website on a new tab.
Well maby this can help you out.
manifest.json
{ "name": "Name of extension",
"version": "0.1",
"manifest_version": 2,
"description": "Opens Tab!",
"browser_action": {
"default_icon": "icon128.png"
},
"icons": {
"48": "icon128.png"
},
"background":{
"scripts": ["background.js"]
}
}
background.js
chrome.browserAction.onClicked.addListener(function(activeTab) {
var newURL = "http://www.google.nl";
chrome.tabs.create({ url: newURL });
});
background.html
<html>
<head>
</head>
<body>
<h1>Hello people</h1>
<br />
<p>Hello fellow pele</p>
</body>
</html>
i hope my answer helped you.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments