chrome.tabs.onUpdated doesn't consider a refresh an update - google-chrome-extension

Basically I have 2 popups that I want to set based on the hostname of the URL. If the hostname is outside the options for the 2 popups then i want to grey it out. I've played with declarativeContent but can't figure how to add a popup with the action: I've also tried to use chrome.tabs.onUpdated which works if you enter the domain or new tab and enter a URL but if you hit refresh it just defaults to the manifest default popup. Any thoughts?

Use chrome.webNavigation events. – wOxxOm
Thanks!

Related

Browser Console - How to include javascript code on every page redirect?

Is is possible to load special javascript code (created by me) to my browser console (mozilla firefox) on every redirect page? I want to create a special script-robot, which will be do special actions on some website. For example:
Click button: "Add new advert"
... NOW IS REDIRECT
Write to input[name='title'] advert title
Write to input[name='description'] advert description
Click button: "Add now!"
... NOW IS REDIRECT
Click button: "Logout".
So I want to include my own javascript code to my console and I want automatically reinclude this file on every page redirect. Is is possible?
Thanks.
yes, it is possible. What you would do is create your own google extension with links to a js file to run. Here are some instructions on how to make said extension.

Displaying page in a frame - Yandex Metrica Webvisor

I have a problem with Yandex Metrica - the webvisor function isn't working on all pages. Instead, it displays
"Not possible to replay visit on the given page.
Possible reasons:
Counter code not configured
Displaying this page in a frame is forbidden"
Is there any way to bypass it? Tried X-Frame-Options Allow-from, but didn't work and I heard it isn't supported in many browsers.
Best regards,
Kuba
Try to disable all AdBlocker Plugins like AdBlock Plus or uBlock Origin. The Session Replays open in a new window and the domain changes from yandex.com to webvisor.com. So be sure to disable your AdBlocker Plugins for the domain Webvisor.com.
Hope that helps! Worked for me :)
in .htaccess file add
Header always set X-Frame-Options SAMEORIGIN

chrome extension options change default popup.html

I have a chrome extension where the popup.html simply has an iframe that loads a page.
I want to allow users to select their language, and as I'm helping a charity do this each language page is very different as they need very different content based on the country!
Therefore, I can't just replace some of the fields like the google developer page example does; I need to change the page that is loaded in the iframe.
e.g. In my directory where the pages are stored I have english.html, german.html, spanish.html all of which are completely different pages.
By default the english.html page loads in the iframe, but the user should be able to go into the options file and select german so when they click on the extension the german.html loads by default every time.
Here is the jsfiddle showing what I currently have in the popup.html, and the popup.js:
http://jsfiddle.net/hemang2/EDV82/
You'll see the flickr API being called, but that's only there because I wasn't sure how to get rid of it!
So essentially my question is how to link the options file to change the default url loaded in the iframe.
Use the setPopup method: http://developer.chrome.com/extensions/browserAction.html#method-setPopup
It allows you to set any html file as your popup.

How can I prevent Google Sites sending all my hyperlinks via their redirect page?

I'm setting up a website using Google Sites.
If I add a hyperlink to a page and select 'Web Address', then enter http://www.example.com as the link, the actual page ends up being rendered with
http://www.google.com/url?q=http://www.example.com
as the hyperlink address. This injects an annoying 'redirecting you to www.example.com' Google page and a two-second delay into following hyperlinks off my page.
Is there any way to turn this behaviour off?
"If the site you're linking to isn't public, it will automatically redirect through www.google.com/url when opened to keep the site's anonymity."
Source: support.google.com/sites/answer/90538
Whatever was causing this behaviour, it seems to have stopped after a few days. No idea why, but I'll call that a fix - the site was very new at the time I posted, so possibly it's something to do with Google tracking people filling pages with dubious links?

Why is Chrome reporting a secure / non secure warning when no other browsers aren't?

When I go to our web site through HTTPS mode, Chome is reporting an error saying that the page contains secure and not secure items. However, I used Firebug, Fiddler, and HttpDebuggerPro, all which are telling me that everything is going through HTTPS. Is this a bug in Chrome?
Sorry but I'm unable to give out the actual URL.
A bit late to the party here but I've been having issues recently and once I had found a http resource and changed it was still getting the red padlock symbol. When I closed the tab and opened a new one it changed to a green padlock so I guess Chrome caches this information for the lifetime of the tab
Current versions of Chrome will show the mixed content's URL in the error console. Hit CTRL+Shift+J and you'll see text like:
"The page at https://www.fiddler2.com/test/securepageinsecureimage.htm contains insecure content from http://www.fiddler2.com/Eric/images/me.jpg."
I was having the same issue: Chromium showing the non-secure static files, but when everything was http://.
Just closing the current tab and re-opening the page in another new tab worked, so I think this is a Chromium/Chrome bug.
Cheers,
Diogo
Using Chrome, if you open up the Developer Tools (View > Developer > Developer Tools) and bring up the Console and choose to filter to warnings, you'll see a list of offending URLs.
You'll see something like the following if you do have insecure content
The page at https://mysite/ displayed insecure content from http://insecureurl.
For the best experience in finding the culprit, you'll want to start your investigation in a new tab.
It is possible that a non-secure URL is referenced but not accessed (e.g. the codebase for a Flash <object>).
I ran into this problem when Jquery was being executing a a few seconds after page load which added a class containing a non-secure image background. Chrome must continually to check for any non-secure resources to be loaded.
See the code example below. If you had code like this, the green padlock is shown in Chrome for about 5 seconds until the deferred class is applied to the div.
setTimeout(function() {
$("#some-div").addClass("deferred")
}, 5000);
.deferred
{
background: url(http://not-secure.com/not-secure.jpg"
}
Check the source of the page for any external objects (scripts, stylesheets, images, objects) linked using http://... rather than https://... or a relative path. Change the links to use relative paths, or absolute paths without protocol, i.e. href="/path/to/file".
If all that if fine, it could be something included from Javascript. For example, the Google Analytics code uses document.write to add a new script to the page, but it has code to check for HTTPS in case the calling page is secure:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
On the release of Chrome version 53 on Windows, Google has changed the trust indications to initiate the circle-i. Afterward, Google has announced a new warning message will be issued when a website is not using HTTPS.
From 2017 January Start, Popular web browser Chrome will begin
labeling HTTP sites as “Not Secure” [Which transmit passwords / ask
for credit card details]
If all your resources are indeed secure, then it is a bug. http://code.google.com/p/chromium/issues/detail?id=72015 . Luckily it was fixed.

Resources