I have developed a simple website using HTML5 and CSS3. I had lots of difficulties making it compatible with browsers other than chrome. "Changing the background image" Animation did not work in Firefox, IE. It worked only in Chrome. I want that visitors of my website should be able access website only if they have chrome, else it should give a warning message, or it may then open the chrome download page. I just don't want visitors to be able to view the "not so pleasant" website that is actually very bad in all other browsers but not chrome.
JavaScript would be good but I don't know anything about it. You can check the website here: http://aspspider.org/samarth
Websites are normally developed to be compatible with most users, not few. I strongly recommend that you redesign your webpage, or at least build a better looking one that doesn't have quite the functionality as Chrome's version, but is still useable by people with IE and FF. Limiting your webpage to people with Chrome is a very bad idea. If you really want chrome users to be able to get the full functionality that you have, then create a separate website in the background that is built for all other browsers. Then, when a user not using chrome loads the Chrome page (by default), then redirect them to the secondary, less functional webpage, and put a notification at the top of the secondary page with something along the lines of`"You are not using Google Chrome. To fully utilize this webpage, please Download google Chrome (That's a link to GC's download page) and reload (link to the default start page) this webpage in that browser instead." The redirect script would be as Merca suggested above:
<script type="text/javascript">
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
if (!is_chrome) window.location.href = "nonchrome/IEindex.html"; // redirects to IE & FF compatible webpage
</script>
Try google frame. It could load as soon as client is IE browser:
http://www.google.com/chromeframe?prefersystemlevel=true
Alternatively detect if browser is Chrome using JS:
<script type="text/javascript">
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
if (!is_chrome) window.location.href = "/get-chrome"; // or something...
</script>
Related
I'm having a problem with youtube embed (iframe) and ie6. I'm currently working on an old site of a client which requires it to support ie6.
The iframe works fine in IE8 above and other browser. But when I checked the page in ie6 in xp (modern.ie images running in virtualbox) it shows error:
"The page cannot be displayed". This only happens on IE6 (running another browser in the same OS - firefox - the iframe works just fine).
I've also tried the <object> method and it only show white page.
Anyone knows how to make this work in IE6, or at least a reason why it doesn't work in that particular browser?
In case this is related: I can't access google's page and its product through IE6 (so I can't check if I can play youtube videos through its website). Maybe this is due to google dropping its support for IE8 under, but I can't find anything actually relate this two after googling for hours.
There is a website that I must use at work quite a bit and the only browser it works on is Internet Explorer.
I'm presuming this is because the code is outdated/incorrect and includes javascript that only IE is able to read.
This is a problem, because I want to use Firefox or Chrome, they are much better browsers.
I believe the issue is Firefox/Chrome (hereinafter referred to as foam) not being able to recognize the following "onclick" command lines. When I press these buttons, the web page does not change as it should.
<button class="MenuButton" title="Create ICL" value="ADDICL" onclick="PageJump('ICLMain.asp?From=ICLHome')">Create ICL
So.... since this is not my website, I cannot re-write all of this code to fix it. It is a corporate owned underwriter website for creating a certain document.
There must be some sort of extension that enables Firefox/Chrome to read Javascript codes like Internet Explorer so that I can use Firefox/Chrome and still use this website.
Try to use chrome extension ie tab, https://chrome.google.com/webstore/detail/ie-tab/hehijbfgiekmjfkfjpbkbammjbdenadd?hl=es. This extension emulate The ie Explorer.
I'm also facing the same problem(Javascript broke). The solution I found is to just add https:// before the link and reload the page and everything will work fine again.
I have tried using JavaScript "AddFavorite" function in my code, but it does not work in Safari. It works in IE, I think I remember Firefox, but nothing I have tried seems to work in Safari. All I want to do is have a link on my website that people can click on and it automatically creates a bookmark in their bookmarks folder/bookmark bar.
Does this entail Applescript or something like it? Or a deeper programming language I am unaware of?
<a href="javascript:bookmarksite('Name', 'website.com')">
From the apple forums: forum-link
On the Mac side at least, Safari does not allow a website to add a
bookmark. I'm pretty sure the same behaviour is in the Windows version
as well.
I've been down this road, and what I discovered was that Safari does NOT allow bookmarks to be made with JavaScript:
Apple Forum
bytes forum
They consider it unsafe. As frustrating as this is, I get their point.
Unfortunately, most things like this tend to be browser-specific, and picky.
my JS is about level 0, but i did find this on an old article here:
One specifically for Chrome:
Add to favourites link for Google Chrome
And another on a cross-browser bookmark link:
Cross-browser bookmark/add to favorites javascript
Hope between the previous comment and these links, you get what you needed.
Chrome and Safari does not allow it for clear security reason.
You could usee a script like this:
http://www.dynamicsitesolutions.com/javascript/add-bookmark-script/
which handles many browser and has a nice fallback: show a browser customized alert with instructuion message.
Es: in chrome it says: "Ctrl+D to add as bookmark"
In IE something similar to the following would work: (MSDN)
window.external.AddFavorite(location.href, document.title);
However, this won't work in other browsers. In Firefox, I believe you can use
window.sidebar.addPanel(document.title, location.href, '');
to create a sidebar panel (not a real bookmark) but as far as I know Chrome and Safari do not allow Javascript to automatically create bookmarks. For those, I recommend giving the user the instructions to do it manually:
drag a link to their bookmarks
pressing Ctrl + D to add a bookmark
Clicking + or star icon in the toolbar
I have a website with a simple Flash animation behind some text and semi-transparent images as a background. I have used swfobject to embed it and set wmode opaque to make it display correctly in most browsers.
For browsers without Flash, the user gets a static background image instead and would not know they were missing anything. However, Android users get the flash background on top of everything as per the known issue with how Flash content is rendered in the Android browser making the site unusable.
I have added a crude browser sniff javascript function to the swfobject code to prevent it from loading for any user agent whith 'Mobile' in it:
<script type="text/javascript">
if (navigator.userAgent.indexOf('Mobile') == -1)
{
var flashvars = {};
var params = { wmode: "opaque" };
var attributes = {};
swfobject.embedSWF("Images/Layout/center_flash.swf", "flashBg",
"1004", "502", "9", "false", flashvars, params, attributes);
}
</script>
The only problem I have left is for Android users browsing with 'Mobile View' turned off as the user agent pretends to be a desktop version of Safari (I think). I do not wish to disable the Flash animation for all Safari users. Is there a way of blocking it for just Andriod users - even if they have 'Mobile View' disabled?
Possible ideas include:
detecting the Flash version with JavaScript or Flash. Does Android use specific versions (version numbers) of Flash which are different from the desktop equivalent?
blocking the specific user agents used by Android devices with 'Mobile View' disabled.
Has anyone come up with an effective workaround for this issue?
Your help/input is appreciated!
You can detect android only by checking the userAgent of the browser in your JavaScript
Something like this:
if (navigator.userAgent.toLowerCase().indexOf("android") != -1)
{
// It's android
}
As far as the flash issue itself, I don't know as I never use flash :P
edit
You can also use that technique for other useragents (I.E. iPhone, iPad, safari)
edit2
Sorry, I just went on my android phone and realized the actual setting changes the userAgent to whatever the user picks (desktop/ipad/iphone/safari). That's no good then, I apologize.
Unfortunately, what you are asking is very difficult then. There are no unique identifiers in the android flash version to give you any help. And the fact that android spoofs the userAgent makes it impossibly to detect if they are on mobile or not.
There exist services that can tell you whether a user is on mobile based on their IP.
I'm sorry to say I don't know how fast, reliable, or expensive they are, but if you must determine whether a user is on Android, that's an avenue to consider
Does anyone know of a script that I can use to automatically add a site to favourites upon clicking of a link for multiple browsers? Atleast Firefox, IE, Chrome would be good.
If not, is there a way I can simulate ctrl+D through Javascript as I know that keystroke adds a site to bookmark in most browsers?
A universal script for adding to bookmarks doesn't exists, because not all browsers expose an API for creating bookmarks. Generally, only IE exposes a direct API for this. Both Opera and Firefox offer a possibility to add a site to bookmarks that will be opened in the sidebar and that is a huge difference. Safari and Chrome also don't expose any API for this task.
Some more info on this topic
I use a small script to attempt adding a bookmark using the most popular window methods, until all have failed. Then it just prompts the user to manually add their bookmark...
Like others have said (above) some browsers prohibit script-activated bookmarking, and because of security they want only users to add bookmarks.
It is not perfect, but it is simple and works well.
function addBookmark()
{
var success=false;
// try each until all fail...
try {
window.external.AddFavorite(window.location, document.title);
success=true;
} catch(e) {}
try {
window.sidebar.addPanel(document.title,location.href,'');
success=true;
} catch(e) {}
if(!success)
{
alert("AUTO BOOKMKARING not supported\r\nIn your current browser.\r\n\r\nPress CTRL+D, or CMD+D\r\nto manually bookmark this page.");
}
}
You can check out this jquery plugin if you are using that or just look at their source if you want to use your own. Though he mentions on his compatibility that Safari and Chrome do not expose this functionality in their API.
http://www.dummwiam.com/jFav
See digitalinspiration.
1st Google result for javascript bookmark.
In internet explorer it works with:
window.external.AddFavorite(document.location,document.title);
in firefox and in opera with:
Some link name
I haven't found a solution for safari / chrome yet.