Reputation: 575
Him I'm using this script to detect browsers, but it seems to not to implementing css in opera. So, in browserdetect.js i have this:
{
prop: window.opera,
identity: "Opera"
},
And in my html i have this:
else if (BrowserDetect.browser == "Opera") {
document.write ('<link href="styles/style.css" media="screen" rel="stylesheet" type="text/css" />');
It seems to be working properly in other browsers, but in Opera it just fails to implement <link href="styles/style.css" media="screen" rel="stylesheet" type="text/css" />
in head part of the page.
Can you suggest what could be the problem? Thank you.
Upvotes: 1
Views: 498
Reputation: 10592
If your having an issue with only opera and css, why not try and edit your current css to add opera specific calls?
This code can be used to target opera only in css:
@media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel-ratio:0) {
#my-id { clear:right; }
}
See here for more on these browser css calls
Upvotes: 0
Reputation: 178413
This works so you have other issues
http://jsfiddle.net/mplungjan/sWvqk/
BrowserDetect.init();
alert("Opera? "+BrowserDetect.browser+":"+(BrowserDetect.browser=="Opera"))
Upvotes: 2
Reputation:
why not use browsecap for php? this could be also good: http://www.dangrossman.info/2010/10/11/a-browscap-ini-parser-in-javascript/ or try this: how to determine the opera browser using javascript
Upvotes: 0