Does anyone knows how to make a particular website their default home page when they click the button "Make this site your homepage" using javascript. This sample code works in IE, but other browsers doesn't know this code.

this.style.behavior = 'url(#default#homepage)';
			this.setHomePage('http://localhost/getuptodate/php/getuptodate.php');

Could someone help me in figuring out on how to do this stuff on other browsers. I've research on this but still can't find good codes that do something like the code mentioned above. Others are redirecting the users to do something to make the website their home page.

Dani AI

Generated

Short answer: you can’t reliably make other browsers accept a “Make this my homepage” click from a regular webpage. The IE-only binary-behavior trick that referenced was always a Microsoft/IE-specific capability and has been deprecated/removed in modern IE/Edge — other browsers never offered a safe, standard API for websites to change a user’s settings. That’s why didn’t find a cross-browser script and why community answers from that era reached the same conclusion. (learn.microsoft.com)

Practical alternatives that actually work for real users: (1) show a small, respectful modal with one-click copy of the site URL plus concise per‑browser instructions so users can set the page themselves; (2) offer a clear “Bookmark / Add to favorites” action; (3) for mobile, make the site a Progressive Web App and surface the install / Add-to-Home-Screen flow; (4) if you really need to automate changes, create a browser extension — WebExtensions can declare a homepage override but installation still requires explicit user consent. These are the supported, user-consent ways to achieve the same result. (developer.mozilla.org)

A minimal, usable pattern to show in your UI: present a tiny help panel that detects common browsers and displays the exact two-line steps for each (example: Chrome — Settings ▸ Appearance ▸ Show home button ▸ enter URL; Firefox — drag tab to Home button or Settings ▸ Home ▸ paste URL; Safari — Safari ▸ Settings ▸ General ▸ Homepage). Include a “Copy URL” button and a short note about why pages cannot change settings silently. For managed systems, administrators can push homepage policies centrally (enterprise), but that’s outside normal webpage control. (howtogeek.com)

Recommended Answers

All 2 Replies

Sorry Lambing, I really can't find anything other than for IE...
Will look into it some more...
Good luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.