user-agent

Check User-Agent with jsf

人走茶凉 提交于 2019-11-29 11:56:09
I want to check the user agent of my client. (If it's possible the browser type/version) But I don't know how do that... Thank you for your help. It is OK, I have find. I use : final HttpServletRequest request =(HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest(); final String userAgent = request.getHeader("user-agent"); System.out.println(userAgent); Thank you for your help. It is sent in the User-Agent http header. HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest(); String userAgent = request.getHeader("user-agent");

Javascript redirect for Internet Explorer browser version user agent?

不打扰是莪最后的温柔 提交于 2019-11-29 11:40:56
I found out that my javascript-intensive web site doesn't work reliably (or at all) in IE9. It works, (usually, but not always) with the compatibility mode meta tag in the header, but I just want to build a page that I know will work well in IE9 and then have the usual page redirect to it when IE9 is detected. The usual page is fine in IE 7 and 8 (and every other browser I've tried it on). Can anyone give me some javascript that will do that? Thank you! Here's my usual page: http://ianmartinphotography.com/test-site/test/ The simplest way would be to use IE Conditionals . Note: IE10 and beyond

PHP Sessions + Useragent with salt

限于喜欢 提交于 2019-11-29 10:19:48
问题 It keeps running in my mind the last couple of days, but I read some articles about how to make your PHP sessions more secure. Almost all of these articles say that you need to save the useragent in the session WITH an additional salt. Something like this: $fingerprint = md5('SECRET-SALT'.$_SERVER['HTTP_USER_AGENT']); The salt would make it harder for an attacker to hijack or whatever the session. But WHY add a salt every time you would check it like this: md5('SECRET-SALT'.$_SERVER['HTTP

How do I create a random user agent in Python + Selenium?

痞子三分冷 提交于 2019-11-29 10:12:17
问题 How do I create a random user_agent in Chrome? I am using fake-useragent. Library here. The printed output is working but when it seems it is not loading into Chrome. I have tried: from selenium import webdriver from selenium.webdriver.chrome.options import Options options = Options() options.add_argument("window-size=1400,600") from fake_useragent import UserAgent ua = UserAgent() a = ua.random user_agent = ua.random print(user_agent) options.add_argument(f'user-agent={user_agent}') driver =

How do you check the browser's user agent in a JSP page using JSTL, EL?

老子叫甜甜 提交于 2019-11-29 09:13:26
I need to check the browser's user-agent to see if it is IE6. However I shouldn't use scriptlets (we have a strict no scriptlets policy) to do this. Currently I use <% String ua = request.getHeader( "User-Agent" ); boolean isMSIE = ( ua != null && ua.indexOf( "MSIE" ) != -1 ); %> <% if( isMSIE ){ %> <div> <% } %> What is the cleanest way to do this using JSTL, EL, etc and not scriptlets? <c:set var="browser" value="${header['User-Agent']}" scope="session"/> Zoltan <c:if test="${fn:contains(header['User-Agent'],'MSIE')}"></c:if> If you are using spring-mobile framework you can use following to

How does one differentiate between Chrome and Safari in an iOS7 useragent string?

╄→гoц情女王★ 提交于 2019-11-29 08:43:39
Useragent details are sketchy, or I'm not looking in the right places. What, in terms of a navigator.userAgent.match() , would differentiate between Chrome and Safari on iOS7, iPad or iPhone? var ua = navigator.userAgent; var matches = ua.match(/^.*(iPhone|iPad).*(OS\s[0-9]).*(CriOS|Version)\/[.0-9]*\sMobile.*$/i); if (!matches) console.log("Not what we're looking for."); else { console.log(matches[1]); if (matches[2] === 'OS 7') console.log(matches[2]); else console.log('Not the right version.'); if (matches[3] === 'CriOS') console.log("Chrome"); else console.log("Safari"); } Reference: https

Nginx proxy or rewrite depending on user agent

喜你入骨 提交于 2019-11-29 08:14:09
问题 i'm new to nginx, comming from apache and i basically want to do the following: Based on user-agent: iPhone: redirect to iphone.mydomain.com android: redirect to android.mydomain.com facebook: reverse proxy to otherdomain.com all other: redirect to ... and tried it the following way: location /tvoice { if ($http_user_agent ~ iPhone ) { rewrite ^(.*) https://m.domain1.com$1 permanent; } ... if ($http_user_agent ~ facebookexternalhit) { proxy_pass http://mydomain.com/api; } rewrite /tvoice/(.*)

How to disguise your PHP script as a browser?

感情迁移 提交于 2019-11-29 06:58:06
问题 We've been using information from a site for a while now (something that the site allows if you mention the source and we do) and we've been copying the information by hand. As you could imagine this can become tedious pretty fast so I've been trying to automate the process by fetching the information with a PHP script. The URL I'm trying to fetch is: http://mediaforest.ro/weeklycharts/viewchart.aspx?r=WeeklyChartRadioLocal&y=2010&w=46 08-11-10 14-11-10 If I enter it in a browser it works, if

User Agent Causes MVC DisplayFor ArgumentException: Illegal characters in path

萝らか妹 提交于 2019-11-29 06:19:27
I'm having a problem where users on mobile devices are encountering an error in MVC that does not occur when viewing the site on a regular desktop. I can consistently reproduce the error by using Chrome's developer tools and applying any other UA than the default. The underlying exception thrown is: ArgumentException: Illegal characters in path. at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional) at System.IO.Path.GetExtension(String path) at System.Web.WebPages.DefaultDisplayMode.TransformPath(String virtualPath, String suffix) at System.Web.WebPages

Is it possible for $_SERVER['HTTP_USER_AGENT'] to not be set?

我的梦境 提交于 2019-11-29 05:29:01
I've just been looking through a website's error_log and one of the error's that has been logged a few times is: [21-Jun-2011 12:24:03] PHP Notice: Undefined index: HTTP_USER_AGENT in /home/ukevents/public_html/lib/toro.php on line 130 The line this pertains to in toro.php is: private function ipad_request() { return strstr($_SERVER['HTTP_USER_AGENT'], 'iPad'); } Is it possible for $_SERVER['HTTP_USER_AGENT'] to not be set by a HTTP request? Maxim Krizhanovsky Yes, it's possible, this a HTTP header sent (or not sent) by client, and you should not rely on it. From php manual: Contents of the