Cross Browser Script to make my website as Home Page [duplicate] - javascript

This question already has answers here:
How can I set default homepage in FF and Chrome via javascript?
(7 answers)
universal javascript for set homepage functionality [duplicate]
(1 answer)
Closed 7 years ago.
I have a website and I would want to ask users to make my website as Home Page. If they click Yes, I would like to run a script that should make my website as the home page of the user's browser. Have got a Similar Thread here and a solution here. However, the solution present in my latter link works only in IE. I need a cross browser script for this.
Can anyone help me on this.

It is not possible to do this via code in most browsers as a security measure. If it was, any website you visit could automatically make itself your homepage without your agreement.
The fact old versions of IE let you do this is very much the exception rather than the rule.
If you require this behaviour, you would need to write a step by step guide telling people what toolbar to click on, and where to set their homepage in their browser settings.

nitesh, google and bing don't do it... any browser that defaults to google or bing or the hewlett packard home page or whatever come pre-packaged with that site as it's home page... the only way to change this, is manually, either by:
1) high-lighting the address in the address bar and dragging it to the little "home" icon
2) going to the browser's settings and pasting or typing the address
3) installing software package such as yahoo messenger or the like, that changes these settings for you when you agree during the installation process, usually by checking a box and clicking agree

Related

How to play background music in JavaScript without user interaction? [duplicate]

This question already has answers here:
Playing sound from INACTIVE browser tab
(2 answers)
Closed 12 months ago.
I have a site where the user can log in and can start and get calls. The login is automatic after the first time, so they can get to the contacts page without interacting with the site other than opening it. It's a site that automatically starts on the computers of the customers, just so they can receive or start calls, hence they might not even interact with the site.
When they receive a call, a background music starts, like this:
var audio = new Audio('ringtone.mp3');
audio.play();
Of course it does not work unless the customer pressed at least a button or hovered over something on the site, or anything like that. I am wondering if it's possible to start background music without user interaction? I understand it is no longer possible because people do not want annoying ads to play, but I'm wondering if there is a still working solution. Or can I somehow ask for their permission like for notifications? I would ask for it once during the first login, then it would get saved.
Edit:
It is not an SPA. Also my problem is not that it does not play sound when the tab is inactive. The problem is that there's a restriction on sounds which prevents JavaScript from playing sounds unless the user did anything on the site, interacted with it (hovering over a button, clicking a button, or anything). The user does not necessarily interact with the site because it starts up automatically, hence the problem when there's an incoming call.
Not sure if the OP's website is a SPA, if your using React, and using something like React-Router etc, this is a SPA (Single Page Application).
Playing Audio automatically in a normal browser window without some form of user action is blocked by most browsers. (sound policy).
Now the reason I asked the OP if his website was a SPA, these work well as Web App's, and Web Apps have a slightly different sound policy. aka, been able to play audio without user interaction.
So how do you make your website into a Web App,..
Easy, you tell the browser :)
For example in Chrome, under more tools, there is an option that says create shortcut.., this does more than just create a shortcut, it also puts your website in Web App mode.
This also works for mobile's too, eg. on Android there is the option Add to home screen,
And yes other browser have this feature too, but Firefox have decided to remove this feature, so it's not a browser I will use, or recommend to my customers anymore. Whats happening with Mozilla, they seem to have been taken over by stubborn dev's. Shame!!
So if the OP website is a SPA, all he has to do is use the create shortcut, and auto start this.
There are other benefits to making into a Web App too, like not having the address bar at the top etc. But again Mozilla have decided that's not what users want or need, thanks Moz, bye bye now..
What if's not SPA?.. ps, SPA just means there is no normal navigation / page loading. (might not have been obvious from my previous explanation).
Ok, things get a little bit more tricky. The OP mentions he auto-starts these in the morning, now the only issue here this prevents any user interaction, so obviously the sound policy kicks in.
So another idea, using something like puppeteer you could start the app, place a button on your website, that could play a startup sound, or even a silent mp3. You could then instruct puppeteer to click this button.

Make my mobile website share on iphone using native share sheet? [duplicate]

This question already has answers here:
Is it possible to trigger share menu on smartphones (via HTML/JS)?
(6 answers)
Closed 8 years ago.
I have a custom share button on my website. When I click in on my desktop computer I have it opening up a AddThis share popup. That works fine. When I open my website on my iPhone, my custom share button does nothing. How do I make it open my iPhone's sharing options Facebook, Twitter, Message, Mail? I don't care if I use a 3rd party share tool or not, I would prefer something like if(iphone)window.opennativesharesheetftw()
In chrome on my iPhone the browser's share options look different but when you click facebook it uses the good native facebook share sheet. I want to use that. I don't want to open a new browser window to the mobile facebook website.
I've tried googling this but I get no results that have anything to do with what I'm searching for.
Then when the user clicks Facebook I want this to show up:
Nope Safari provides no interface to programatically display its UIActivityViewController - Could you imagine how bad that would be if sites could put javascript code that brought that up whenever they felt like it? YIKES!
You could bring it up whenever you'd like if you were creating your own application, but as far as what you are able to do just creating a mobile site, there aren't too many options.
One 'trick' I've seen some sites do is detect that you're on iOS and put a fixed image at the bottom of the page that points to the share button. Well, I've seen people do that for the bookmark button, but you get the idea.

Pre-loading/refreshing the page in backend before showing on the browser [duplicate]

This question already has answers here:
How do we control web page caching, across all browsers?
(29 answers)
Closed 9 years ago.
I wanted to know if there's a way to refresh/pre-load the CSS of a page before it shows on the browser to a user. Because sometimes we make crucial design changes to our website and the next time we open it the design shows all messed up, until the user refreshes the browser, which then puts the design in the intended positions.
So, what I want is to have a way to refresh a page before it completely loads, so that a user doesn't have to look at a messed up design and doesn't have to leave the site because of such a problem.
Please Help. Appreciated.
In addition to cache settings in the browser, you can add unique code/hash of css in the name.
E.g. http://xxx.static.com/1/css.css
When you deploy the next version, it could be http://xxx.static.com/2/css.css.
So that existing pages are not distorted for users as they would be referring the old css with which everything looks fine.
Thanks

How does github lets you navigate pages without refresh? [duplicate]

This question already has answers here:
How to change URL in browser without navigating away from page?
(2 answers)
Closed 9 years ago.
I've navigated a lot through the github website. I've observed that whenever I click on a link, the page does not refresh and even the URL in the browser is changed. Moreover, those links are added in the history!
Well, I know that AJAX is a way to go and I know a lot of JavaScript(semi-intermediate level coder) but you can't change the URL with Ajax. Neither can you make those URLs be visible in the history.
So, how the heck do they do it?
There's a lot of tools out there to make this process easy nowadays, check out HistoryJS and NavJS.
Microsoft released an example application harnessing these technologies a while ago named "Big Shelf", which seems to have been taken down unfortunately. Obviously that's only relevant if you're using .NET.

Does Facebook Connect have a javascript API that doesn't open a new window? [duplicate]

This question already has answers here:
Facebook Connect Dialog Popup
(2 answers)
Closed 8 years ago.
I want it to have a popup dialog javascript box. Instead of a new window.
I've seen it before. How can I get it?
Thanks.
Unfortunately, Facebook prohibits using a javascript pop-up instead of a new window. Until early this year, they weren't doing anything to block it, so some sites were doing it that way.
Now they've started detecting when they're in an iframe and are putting up a black overlay that, when clicked, opens their login in a new window. At least their implementation still allows sites that are doing it the "wrong" way to work with no changes, but it's frustrating.
It's possible to work around this using their mechanisms for client authentication, but that involves your web site prompting for the user for their Facebook password which is a horrible idea for security and privacy reasons as well as an explicit break of Facebook TOS.

Categories