Can I check with JavaScript whether the page is displayed in a browser or as a bookmark Shortcut on the homescreen?
Almost certainly not. The only reasonable way to implement the bookmark on the home screen is to use a snapshot stored locally. Think about it: The device isn't going to visit all of those pages every time you go to the home screen; that would eat up your data transfer allowance, be slow, and irritate people. Instead, it will remember a snapshot of the page as of the last time you visited, store that locally, and use that. (For instance, that's how Chrome for Desktop's New Tab page works showing your popular destinations. That's not the exact same thing, but it's effectively the same use case — and on a desktop browser where extra data transfer isn't usually an issue.)
Related
We keep making changes on one of our old site and we need to show an alert for the users who come back / repeating visitors or the users already visited.
Since we made the changes, browsers show the cache site to them and hence it shows broken to them when they visit back after we have made changes.
So, I want to show an alert to ONLY repeating visitors to clear their browsers cache.
I use cookies to store information, I tried to show cookie based alert to the clients, but again that alert was also visible to new visitors too, which is obviously not required as their browser seeing my site for the first time and would not reload the cache site.
Is there any way, I can popup an alert ONLY to my existing or repeating visitors using jquery / javascript / php?
That's a really bad idea. As an user I shouldn't have to care about browser caches or even know what they are. Bothering me with an alert isn't good either.
Consider adding a global "cache busting" parameter to all of your asset URLs, like so:
<link rel="stylesheet" href="style.css?v1">
<script src="script.js?v1"></script>
Then all you have to do is change the version number and all your visitor will see the updated assets without having to do anything special.
We've just upgraded group policies at work because of a big migration project. Nevermind... The thing is, some of our users use this java application, which reads the smart card reader. On new machines it doesn't work in IE, it has to run in firefox. The trouble is, that the first time firefox opens it, it says there's no java. As soon as you reload it, it's fine.
As users are users, they hate the thought of having to reload the page, and it's not very elegant either. As the process of upgrading anything in the company is difficult, and I'm only an entry level desktop support guy, it won't get fixed any time soon.
So I was thinking... is there any way to create a shortcut, that would open the page and then reload it once it finishes loading the first time?
It can be a shortcut to a local html file which then redirects it to the final location...
You can use a vbs:
set WScriptShell = CreateObject("WScript.Shell")
WScriptShell.Run("http://www.facebook.com/")
WScript.Sleep(2000)
WScriptShell.SendKeys "{F5}"
This one opens a page in the browser, waits 2000 ms (probably enough for the page to load) and then sends the "F5" key to the currently active window. This may not be a perfect solution, but you can extend it to match your needs.
Have you tried $( document ).ready() and insert the code in this function? This basically waits your whole page to load and after that executes the code in the function.
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!
Im hosting a rails app on heroku. It runs on the client on a touchscreen with Google Chrome in Kiosk mode, so no browser chrome or keyboard. The login/home page is different for every kiosk.
Error pages are static assets, so I'll have to do this with Javascript. If there is an error I want to display a button that will let the user get back to the home page.
I can't just use a back button script b/c of the potential for multiple errors. I thought about using localstorage to store a reference to the home page, but the error pages are served from a different domain so they wont have access.
Any ideas?
Edit:
This works in Firefox onClick="window.home();" If I set the browser's home page to that particular kiosk. But apparently isn't supported in Chrome. Is there any way to store some kind of variable that any domain can access on a per browser/kiosk basis.
I think you're making this too hard. You already have the information you need to go back stored in "local storage" -- the browser history. Simply use javascript to look at the history and go back as far as you need.
As far as returning to the home page, isn't the home page a well known URI? What's wrong with go home?
Update
Isn't the home page always going to be the first page in the history? You seem to be saying that you're in a situation where you want to return to a page for which you don't know the base URI, don't know how you got where you are, and don't know where you started.
I suppose you could put the place you'd like to go into a cookie, but if you don't even know the base URI, how would you retrieve it?
I'm beginning to think the real answer is "you need to rethink your design, there's something deeply wrong."
My site frames content like DiggBar and the Facebook share bar.
If a user wants to break out of the framed content, and visit the underlying site directly, we cannot guarantee the current page will be displayed, since there is no way for JS or HTML to query the current URL of an iFrame (for security reasons).
All we can do is show the page originally loaded in the iFrame.
The question: if we set up the service as a toolbar or plug-in, could we then have the capability to query a given web page and ascertain the current URL for each iFrame? This way, if a user clicks to different pages in the iFrame, then decides to break out, we can guarantee displaying the correct page.
Thanks!
if you decide to step out of the JS/DHTML boundaries, you get more power and capabilities.
There should be a way to do so in each browser you decide to support (IE, FF, etc.). Though there would be the price one might pay for requiring a software installation.