chrome extension update and rewrite to another same extensions - javascript

hello i have chrome extension which adds background.html as new tab.
its like speed deal , when you are opening new tab it automatly opens.
i have 26k users but every day only half visits my extension. (opens new tab with my background html) because after my extension maybe users installed another junk extensions which adds website as new tab.
so i want to return back my users by update.
<html>
<head></head>
<body style="margin:0px;padding:0px;">
<iframe
style="width:100%;height:100%;margin:0px;padding:0px;border:none;"
src="/background.html"
name="ext-newtab-iframe"></iframe>
</body>
</html>
my extensions code looks like that how can i change if i want to return back my users. i want to rewrite it to another extensions

You can't programmatically retake the new tab page. The most recently downloaded new tab extension overrides the new tab page, and your scripts have no access to another extension's pages or scripts. Even if you could do it I would not suggest it.
why not?
By doing so you give your users that are using another new tab extension a reason to uninstall your extension. Maybe they don't want your extension anymore, or maybe they kept your extension to use it later. But if it overrides what they want, they won't be happy. Which means you will loose installs, and maybe get a few bad reviews which isn't ever good.
You shouldn't take control over what your users want or don't want. Users expect to be able to do whatever they want to do with your extension, and as a result they'll be happy.
I don't know how reliable your analytics are, but a lot of people don't use their computers every day. Others could be using their laptop for a day, and their chromebook the next. There aren't necessarily that many people that aren't actively using your extension.
Solution:
If you want you could open a page when your extension updates notifying your users of any changes, and reminding those that aren't using it that they have it.
READ:
http://www.swansonrussell.com/perspectives/articles/are-you-annoying-your-web-users , specifically the 3rd reason

Related

Adding a local JS script to a website whenever i visit it?

I dont know if it's possible but basically I have this problem:
I have a website that I regularly visit and it has a tons of sub-urls.
I wrote myself another script / site which I'm using on XAMMP / localhost to analyze things (based on the website).
Now whenever I visit said website, I want there to be button (on each site) that links a href to my localhost. So whenever I have XAMMP running, I could simply click to create a new tab from the website to my localhost site.
This as opposed to having to manually open my corresponding localhost site.
Is something like this possible ?
If not, would there be another feasible solution to "sort of" alter the website so I can use it better in conjunction with my custom scripts ?
You might want to see chrome/Firefox extension Greasemonkey or Tampermonkey which allows running userscripts.

Can a Chrome extension act as a web app in place of a website?

I'm trying to develop a Chrome extension that is supposed to completely replace a specific website's pages with a new UI. In other words, when the user visits said website, the extension should "intercept" it seamlessly and display the new "app" (preserving the URL and without opening a new tab or window). I currently use a content script to manipulate the DOM, but it's too messy.
Chrome apps such as Google Docs achieve the same goal through URL handlers, but they're not an option since they're now deprecated.
Currently, I'm aware of two options:
Intercept the URL and redirect it to an extension URL. I want the URL to be preserved.
Use a content script to stop the page from loading at document_start (using window.stop()) and then "inject" the new app. Apparently, that works, but it sounds quite hacky and prone to unexpected glitches.
What I'd like to know:
Is the second approach good enough? What limitations and other issues will I face if I use it?
Is there any other approach that is at least as good (and preferably designed for this purpose)?
You can't open a chrome app in a tab, only in a window. I don't think they have content scripts either.
Also, chrome apps are now only available on chrome os when you publish it for the first time (existing chrome apps work for any os).
To solve your question, you could use an extension with content scripts and just open up an iframe fullscreen so the url is preserved in the omnibox and it could have the page you want in the iframe as the page that would be in the app.
Content handlers are meant for opening a special protocol url to do something like send an email, etc. Examples would be like tel://, sms://, mailto:, etc.
So you would not want this. Also they aren't that noticable when approving to handle the protocol.

Developing Chrome Extension. Would like it to get the current website without constant refresh

UPDATE: Found How can I get the current tab URL for chrome extension?
I require the tab.ID to refer to a tab of a specific URL. However not sure if this means me issuing the extension refresh itself constantly (or will the iframe the extension is contained within do this live)?
================
OP
I would like to develop a Chrome extension. At this stage of development what I need it to do is 'know' which website it is on. I'm not very experienced with JavaScript (I have some experience developing applications in Java and C, whereas Python is kind of my specialty language and I've deployed a lot of powerful tools using this).
I'm not sure how to go about getting live information of the website the user is currently viewing without constantly refreshing the iframe the application is contained in. I'm thinking of some kind of for loop to do this work for me but I'm also worried about the rate at which this refresh is going to take place (I don't want Chrome to start CPU hogging if many tabs are open).
The framework I'm looking to use during development looks like this (not sure if this is ideal but this is what I have in mind)...
FOR [EXTENSION IFRAME]
{
Extension page IS Extension_OFFLINE (indicating tab is not on, online_example_page)
Extension page IS Extension_ONLINE (indicating tab is on, online_example page).
}
Such that [EXTENSION IFRAME] actively detects what web-pages you are viewing. I would like to avoid refreshing the extension constantly to get this information if possible.
So what it'll look like is the logo and html page will change depending on whether or not you're connected to the online_example page which could be https://example.com.
If the user is on different tabs this is fine. I only need it to detect at least one instance of https://example.com (so ideally ranging over all tabs).
Thank you in advance if you're able to help!

Creating multiple sessions with each new tab with chrome extension

I'm trying to create a new session with each new opened tab. So if I call "chrome.tabs.create" and hit the same url I would like it to create a new session. For example if I hit one page and they use cookies to store my cart when I call "chrome.tabs.create" for a second time it just retrieves my previous session and both tabs are essentially the same thing. Is there a way to do this?
No, not really, not with an extension.
You can open an incognito tab, but that gives you a second session, you can't open "another" incognito context until you close the first one.
A Chrome App can use webviews with different partitions to this effect, but cannot really interact with normal browsing.
Webview is not yet available for extensions and it's unclear when that will change.
If you need this really badly you can try manipulating cookies with chrome.cookies API.
I tested many exteension in Chrome and even the SessionBox seems promising I encouterned some bugs so that I cannot use it easily: I had to recreate my profile everytime regularly.
Afer that I found a chromium fork called ghostbrowser which have exactly the feature your need to.
This is a very good alternative as long you are ok with the 4 identities limitation of the Free version.

How can I gently "bust" UIWebview?

Recently, a few developers have started creating apps which do nothing more than point at state-owned content (free, public property) through UIWebViews. This wouldn't ordinarily be a problem, except the apps are all ad-supported and some are even paid. Essentially, they're making money on state-owned content.
My question is this: how can I force the site to open a new Safari window rather than display in the UIWebview (which is wrapped in their app's branding)? I am able to detect UIWebview using the following, but am unable to do anything besides simply hide the content. I'd prefer it to provide a link to our content which then opens in Safari.
This is how I'm detecting UIWebview:
var is_uiwebview = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent);
unfortunately its fairly trivial for a developer to force the User-Agent string to anything they want, so your attempts to thwart these developers might only be temporary. You can't force your content to be viewed in a browser. A user could use a tool like CURL to view your content also...
Once you detect that you're in the UIWebview, you need to fire a window.open() to put your content in a fresh window.
This talks about some quirks that make it a little tricky (but not impossible): Opening popup links in UIWebview. Note that the question there is the reverse of yours, but the accepted answer does show how to get UIWebview to pop a new window via Javascript.
This has been a concern ever since the Web began. You can't stop people from scraping your content, but you can make it hard to reframe it.
Edited to add
Unfortunately for you, the app can intercept window.open(): UIWebView respond to Javascript calls
I suppose you could always give up and show a banner that says something like "you paid for this data with your taxes, you shouldn't pay for it again with ads. Just open a browser and go to ... "
You can find out if it is a WebView or Mobile Safari, as seen in this thread. The problem is, that you could only open Safari via a custom URL scheme, but think, only http://, https:// etc. work. Even if there would be something like safari-http://, the programmers of the apps with the UIWebView could catch that request and redirect it back into the web view. So, I'm sorry to say: That's not possible.

Categories