Search Results

Search found 13705 results on 549 pages for 'browser'.

Page 11/549 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Rails Browser Detection Methods

    - by alvincrespo
    Hey Everyone, I was wondering what methods are standard within the industry to do browser detection in Rails? Is there a gem, library or sample code somewhere that can help determine the browser and apply a class or id to the body element of the (X)HTML? Thanks, I'm just wondering what everyone uses and whether there is accepted method of doing this? I know that we can get the user.agent and parse that string, but I'm not sure if that is that is an acceptable way to do browser detection. Also, I'm not trying to debate feature detection here, I've read multiple answers for that on StackOverflow, all I'm asking for is what you guys have done. [UPDATE] So thanks to faunzy on GitHub, I've sort of understand a bit about checking the user agent in Rails, but still not sure if this is the best way to go about it in Rails 3. But here is what I've gotten so far: def users_browser user_agent = request.env['HTTP_USER_AGENT'].downcase @users_browser ||= begin if user_agent.index('msie') && !user_agent.index('opera') && !user_agent.index('webtv') 'ie'+user_agent[user_agent.index('msie')+5].chr elsif user_agent.index('gecko/') 'gecko' elsif user_agent.index('opera') 'opera' elsif user_agent.index('konqueror') 'konqueror' elsif user_agent.index('ipod') 'ipod' elsif user_agent.index('ipad') 'ipad' elsif user_agent.index('iphone') 'iphone' elsif user_agent.index('chrome/') 'chrome' elsif user_agent.index('applewebkit/') 'safari' elsif user_agent.index('googlebot/') 'googlebot' elsif user_agent.index('msnbot') 'msnbot' elsif user_agent.index('yahoo! slurp') 'yahoobot' #Everything thinks it's mozilla, so this goes last elsif user_agent.index('mozilla/') 'gecko' else 'unknown' end end return @users_browser end

    Read the article

  • Best way to calculate unit deaths in browser game combat?

    - by MikeCruz13
    My browser game's combat system is written and mechanically functioning well. It's written in PHP and uses a SQL database. I'm happy with the unit balance in relation to one another. I am, however, a little worried about how I'm calculating unit deaths when one player attacks another because the deaths seem to pile up a little fast for my taste. For this system, a battle doesn't just trigger, calculate winner, and end. Instead, it is allowed to go for several rounds (say one round every 15 mins.) until one side passes a threshold of being too strong for the other player and allows players to send reinforcements between rounds. Each round, units pair up and attack each other. Essentially what I do is calculate the damage: AP = Attack Points HP = Hit Points Units AP * Quantity * Random Factors * other factors (such as attrition) I take that and divide by the defending unit's HP to find the number of casualties of defending units. So, for example (simplified to take out some factors), if I have: 500 attackers with 50 AP vs 1000 defenders with 100 HP = 250 deaths. I wonder if that last step could be handled better to reduce the deaths piling up. Some ideas: I just change all the units with more HP? I make sure to set the Attacking unit's AP to be a max of the defender's HP to make sure they only kill 1 unit. (is that fair if I have less huge units vs many small units?) I spread the damage around more by including the defending unit's quantity more? i.e. in that scenario some are dead and some are 50% damage. (How would I track this every round?) Other better mathematical approaches?

    Read the article

  • Selenium - Could not start Selenium session: Failed to start new browser session: Error while launching browser

    - by Yatendra Goel
    I am new to Selenium. I generated my first java selenium test case and it has compiled successfully. But when I run that test I got the following RuntimeException java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: Error while launching browser at com.thoughtworks.selenium.DefaultSelenium.start <DefaultSelenium.java:88> Kindly tell me how can I fix this error. This is the java file I want to run. import com.thoughtworks.selenium.*; import java.util.regex.Pattern; import junit.framework.*; public class orkut extends SeleneseTestCase { public void setUp() throws Exception { setUp("https://www.google.com/", "*chrome"); } public void testOrkut() throws Exception { selenium.setTimeout("10000"); selenium.open("/accounts/ServiceLogin?service=orkut&hl=en-US&rm=false&continue=http%3A%2F%2Fwww.orkut.com%2FRedirLogin%3Fmsg%3D0&cd=IN&skipvpage=true&sendvemail=false"); selenium.type("Email", "username"); selenium.type("Passwd", "password"); selenium.click("signIn"); selenium.selectFrame("orkutFrame"); selenium.click("link=Communities"); selenium.waitForPageToLoad("10000"); } public static Test suite() { return new TestSuite(orkut.class); } public void tearDown(){ selenium.stop(); } public static void main(String args[]) { junit.textui.TestRunner.run(suite()); } } I first started the selenium server through the command prompt and then execute the above java file through another command prompt. Second Question: Can I do right click on a specified place on a webpage with selenium.

    Read the article

  • HMTL5 Anti Aliasing Browser Disable

    - by Tappa Tappa
    I am forced to consider writing a library to handle the fundamental basics of drawing lines, thick lines, circles, squares etc. of an HTML5 canvas because I can't disable a feature embedded in the browser rendering of the core canvas algorithms. Am I forced to build the HTML5 Canvas rendering process from the ground up? If I am, who's in with me to do this? Who wants to change the world? Imagine a simple drawing application written in HTML5... you draw a shape... a closed shape like a rudimentary circle, free hand, more like an onion than a circle (well, that's what mine would look like!)... then imagine selecting a paint bucket icon and clicking inside that shape you drew and expecting it to be filled with a color of your choice. Imagine your surprise as you selected "Paint Bucket" and clicked in the middle of your shape and it filled your shape with color... BUT, not quite... HANG ON... this isn't right!!! On the inside of the edge of the shape you drew is a blur between the background color and your fill color and the edge color... the fill seems to be flawed. You wanted a straight forward "Paint Bucket" / "Fill"... you wanted to draw a shape and then fill it with a color... no fuss.... fill the whole damned inside of your shape with the color you choose. Your web browser has decided that when you draw the lines to define your shape they will be anti-aliased. If you draw a black line for your shape... well, the browser will draw grey pixels along the edges, in places... to make it look like a "better" line. Yeah, a "better" line that **s up the paint / flood fill process. How much does is cost to pay off the browser developers to expose a property to disable their anti-aliasing rendering? Disabling would save milliseconds for their rendering engine, surely! Bah, I really don't want to have to build my own canvas rendering engine using Bresenham line rendering algorithm... WHAT CAN BE DONE... HOW CAN THIS BE CHANGED!!!??? Do I need to start a petition aimed at the WC3???? Will you include your name if you are interested??? UPDATED function DrawLine(objContext, FromX, FromY, ToX, ToY) { var dx = Math.abs(ToX - FromX); var dy = Math.abs(ToY - FromY); var sx = (FromX < ToX) ? 1 : -1; var sy = (FromY < ToY) ? 1 : -1; var err = dx - dy; var CurX, CurY; CurX = FromX; CurY = FromY; while (true) { objContext.fillRect(CurX, CurY, objContext.lineWidth, objContext.lineWidth); if ((CurX == ToX) && (CurY == ToY)) break; var e2 = 2 * err; if (e2 > -dy) { err -= dy; CurX += sx; } if (e2 < dx) { err += dx; CurY += sy; } } }

    Read the article

  • How to simulate slow internet connection

    - by V-Light
    I currently deploy with GAE (google app engine) and I try to implement some AJAX validation. So I got a couple text-fields and "spinners" (ajax loaders) which should be displayed when an AJAX request is sent. But I deploy on my local computer (localhost), so the GAE SDK reacts very fast on any request. It takes about 50-70 ms(miliseconds) to perform the whole ajax request, which is far far away from the real. Is there a way to somehow simulate slow Internet connection? I just want to see how my "spinners" work. I want to test some ajax setting (jquery) about timeouts, errors and so on... Any ideas ?

    Read the article

  • Firefox - setting/extension to toggle between showing & hiding of all images, without reloading the page

    - by galacticninja
    I'm looking for a Firefox setting or extension that can easily toggle between showing and hiding of all images without reloading the page (similar to Opera's feature - the 'Show only cached images' feature is preferable, but optional in my case). I have found an extension that can show/hide images (Image-Show-Hide) but it needs to reload the page to show/hide the images. I prefer that the page not reload when unhiding images from a page previously set to hide all images.

    Read the article

  • Persisting Session Between Different Browser Instances

    - by imran_ku07
        Introduction:          By default inproc session's identifier cookie is saved in browser memory. This cookie is known as non persistent cookie identifier. This simply means that if the user closes his browser then the cookie is immediately removed. On the other hand cookies which stored on the user’s hard drive and can be reused for later visits are called persistent cookies. Persistent cookies are less used than nonpersistent cookies because of security. Simply because nonpersistent cookies makes session hijacking attacks more difficult and more limited. If you are using shared computer then there are lot of chances that your persistent session will be used by other shared members. However this is not always the case, lot of users desired that their session will remain persisted even they open two instances of same browser or when they close and open a new browser. So in this article i will provide a very simple way to persist your session even the browser is closed.   Description:          Let's create a simple ASP.NET Web Application. In this article i will use Web Form but it also works in MVC. Open Default.aspx.cs and add the following code in Page_Load.    protected void Page_Load(object sender, EventArgs e)        {            if (Session["Message"] != null)                Response.Write(Session["Message"].ToString());            Session["Message"] = "Hello, Imran";        }          This page simply shows a message if a session exist previously and set the session.          Now just run the application, you will just see an empty page on first try. After refreshing the page you will see the Message "Hello, Imran". Now just close the browser and reopen it or just open another browser instance, you will get the exactly same behavior when you run your application first time . Why the session is not persisted between browser instances. The simple reason is non persistent session cookie identifier. The session cookie identifier is not shared between browser instances. Now let's make it persistent.          To make your application share session between different browser instances just add the following code in global.asax.    protected void Application_PostMapRequestHandler(object sender, EventArgs e)           {               if (Request.Cookies["ASP.NET_SessionIdTemp"] != null)               {                   if (Request.Cookies["ASP.NET_SessionId"] == null)                       Request.Cookies.Add(new HttpCookie("ASP.NET_SessionId", Request.Cookies["ASP.NET_SessionIdTemp"].Value));                   else                       Request.Cookies["ASP.NET_SessionId"].Value = Request.Cookies["ASP.NET_SessionIdTemp"].Value;               }           }          protected void Application_PostRequestHandlerExecute(object sender, EventArgs e)        {             HttpCookie cookie = new HttpCookie("ASP.NET_SessionIdTemp", Session.SessionID);               cookie.Expires = DateTime.Now.AddMinutes(Session.Timeout);               Response.Cookies.Add(cookie);         }          This code simply state that during Application_PostRequestHandlerExecute(which is executed after HttpHandler) just add a persistent cookie ASP.NET_SessionIdTemp which contains the value of current user SessionID and sets the timeout to current user session timeout.          In Application_PostMapRequestHandler(which is executed just before th session is restored) we just check whether the Request cookie contains ASP.NET_SessionIdTemp. If yes then just add or update ASP.NET_SessionId cookie with ASP.NET_SessionIdTemp. So when a new browser instance is open, then a check will made that if ASP.NET_SessionIdTemp exist then simply add or update ASP.NET_SessionId cookie with ASP.NET_SessionIdTemp.          So run your application again, you will get the last closed browser session(if it is not expired).   Summary:          Persistence session is great way to increase the user usability. But always beware the security before doing this. However there are some cases in which you might need persistence session. In this article i just go through how to do this simply. So hopefully you will again enjoy this simple article too.

    Read the article

  • Auto shutdown computer after all downloads finish - Firefox

    - by galacticninja
    The 'Auto Shutdown computer after all downloads finish' extension that I used for Firefox 3.6 - Auto Shutdown 3.6.2D by InBasic , does not work with Firefox 4 or higher, even if I tweaked it to force its compatibility with versions of Firefox higher than 3.6. Can anyone recommend another extension, software, or solution that can automatically shutdown the computer after all downloads have finished in Firefox 4 or later versions? The OS I'm using is Windows 7.

    Read the article

  • Bandwidth preserving browsing mode

    - by Elazar Leibovich
    I'm looking at some methods to browse the web, in situations where bandwidth is scarce (such as, flaky wifi connection, or mobile phone internet provider who overcharges the bandwidth). One thing that would save alot of bandwidth is not downloading images while browsing. This approach has two main drawbacks Sometimes a site's layout depends of images. There are some images you wish to see (thus disabling images downloading through firefox settings is not quite convenient). I'm looking therefor for a method that would allow me to Use some heuristic to find out which images are related to the website layout and allow them to be downloaded. Select a particular image from a website, download and display it. Maybe there's a firefox extension for that?

    Read the article

  • How can Firefox masquerade as Chrome?

    - by Christos Jonathan Hayward
    I have access to Firefox but not Chrome under XP. I would like extensions to make it more Chrome-like: in particular, 1: A tabbed theme that works like Chrome. 2: One address/search bar that will go to URLs and submit search queries appropriately. (I have already installed "Download Statusbar.") I am looking on a relatively superficial level; I'm not hoping to simulate V8 or Chrome's screaming render times. But I would like a setup that minimally breaks the illusion for someone accustomed to Chrome.

    Read the article

  • Whats the thing the report bugs in php?

    - by Max Hazard
    Currently I am learning php. Php is understood by browser itself right from php sdk right? SDK include libraries right? So browser is like an interpreter of php codes. I want to know that whenever I type a wrong php syntax what is the thing report me the error? Obviously the browser is reporting the error. But what part of it? I mean I don't get it. Like writing a compiler we do lexical analysis and make the compiler which report any bug in source code. I assume here browser is analogous to compiler. I don't know exactly but compiler contains bug report functions or methods which is debugger. Debugger is part of compiler which report bugs. Does the browser contains such debuggers? Can there be any browser which doesn't understand php?

    Read the article

  • Chrome developer tools - network panel gaps

    - by Chris Nicholson
    In the Chrome developer tools, under the network tab, I'm curious to know what is happening during the gaps. If you look at my image below, I have highlighted in orange the areas where these gaps exist. Where I'm able to load a lot of my page from cache it's a shame these large gaps occur as they make up most of my page load time. What exactly is happening in this time? EDIT Okay I found this answer which essentially sums up my question, so a different question: does anyone know a good method to reduce the length of these gaps? Presumably (albeit rather extreme) if I loaded all my CSS on the page there wouldn't be a delay after loading the CSS file before the images were loaded.

    Read the article

  • Firefox keyboard shortcuts to menu items / add-on functions

    - by Cel
    At the moment I'm using context menus a lot to access commands in Firefox, but I would like to replace this repetitive clicking and searching with keyboard shortcuts for the common tasks that I perform. How to assign keys to add-on functionality? E.g. I use Close Other Tabs from Tab Mix Plus a lot - but I could not find any add-on that allows me to create a key combination for it e.g. Ctrl Alt Shift F4? My search did yield Key config, but this extension does not allow mapping to add-on functions I thought Menu Editor might be relevant, as you can change menus with it, and re-arrange even add-on items A rather demanding solution here, which seems to require re-compiling some jar files Customizing menu shortcuts in Firefox

    Read the article

  • Disable browser 'Save Password' functionality

    - by mattsmith321
    One of the joys of working for a government healthcare agency is having to deal with all of the paranoia around dealing with PHI (Protected Health Information). Don't get me wrong, I'm all for doing everything possible to protect people's personal information (health, financial, surfing habits, etc.), but sometimes people get a little too jumpy. Case in point: One of our state customers recently found out that the browser provides the handy feature to save your password. We all know that it has been there for a while and is completely optional and is up to the end user to decide whether or not it is a smart decision to use or not. However, there is a bit of an uproar at the moment and we are being demanded to find a way to disable that functionality for our site. Question: Is there a way for a site to tell the browser not to offer to remember passwords? I've been around web development a long time but don't know that I have come across that before. Any help is appreciated. Thanks, Matt

    Read the article

  • What is better: CSS hacks or browser detection?

    - by Darryl Hein
    Commonly when I look around the Internet, I find that people are generally using CSS hacks to make their website look the same in all browsers. Personally, I have found this to be quite time consuming to find all of these hacks and test them; each change you make you have to test in 4+ browsers to make sure it didn't break anything else. About a year ago, I looked around the Internet for what other major sites are using (Yahoo, Google, BBC, etc) and found that most of them are doing some form of browser detection (JS, HTML if statements, server based). I have started doing this as well. On almost all of the sites I have worked on recently, I use jQuery, so I use the built in browser detection. Is there a reason you use or don't use either of these?

    Read the article

  • Check for Block Ads/Scripts (Browser Addons, Compatibility)

    - by acidzombie24
    I'm conflicted. you guys decide if this should migrate to SU or not. I would like to test my site against popular browser ad ons. ATM i have tested against noscript and adblock plus for firefox. What other popular ad ons should i check compatibility with? By compatibility i mean to work as intent on browsers i support (opera, firefox, chrome, IE 7/8) which include ads. NoScript broke my site and for adblock plus i ask once per week to consider allowing ads. When i see IE6 i notify the user the site is known to be unusable with that browser (The site is script heavy by nature and i wouldnt want to accidentally serve ads to infect users of IE6 with a virus).

    Read the article

  • Silverlight 4 - elevated permission *inside* the browser

    - by Doug
    I know Silverlight 4 can handle elevated permissions outside the browser. Is there a way to accomplish this inside the browser? I need to make a folder/file upload manager that gives a better user experience than the standard , and I'd like to implement it in Silverlight. I know Java has an option to gain elevated permissions, but you have to attach a signed certificate to your app. Does Silverlight 4 have a similar option - to gain elevated permissions by attaching a signed certificate (after warning the user, of course)? -Doug

    Read the article

  • Handling multiple sessions for same user credentials and avoiding new browser window opening in my w

    - by Kabeer
    Hello. I want to handle following scenarios in my new web application. If multiple users log into the application with same credentials, the application should deny access. Since I have out of process session store, I would be able to make out when this situation happens. So I can deny all requests after first successful attempt. This will however not work if the user instead of logging out of the application, closes the browser. The session will continue to reflect in the store for the period of timeout value. If a user attempts to open a new browser windows (Ctrl+N), the application should defeat this attempt. Every new page can potentially fiddle with cookies. I want to therefore deny the users the ability to open new window.

    Read the article

  • Changing Render Kits in Browser

    - by John
    I'm working on a project to develop a cross-browser testing web app. Simply put, I'm tired of having to maintain multiple browsers on the same system and IE in VMware solely for the purpose of testing. Does anyone know if there is any way to change the render kit programmatically? For example, if I insert a URL, I would be able to load the URL and switch the browser render within a frame of some assortment. I am experienced with PHP, JS, and RoR if there is a solution using any of those. Thank you! John

    Read the article

  • Textbox height in a small browser window

    - by Fritz H
    Hi folks, I have here a peculiar problem. We have a RAP application intended for use on a PDA/phone, but when it is displayed in a small browser window, all the textboxes on the form(s) are too tall (around twice the height they should be). I've stepped through the code (The form is using GridLayout, number of columns=1, make columns equal=false) and have found that the TextSizeDetermination.getCharHeight() method returns an incorrect font size if the browser window is too small - 13px if the window is large, 26px (exactly double) if the window is too small. Interestingly enough, it seems that if the window is too small, probeStore.containsProbeResult(font) in that method returns true and uses probeStore.getProbeResult(...).getSize().y for the font size. Otherwise, if the window is larger, it returns false and uses TextSizeEstimation.getCharHeight(...). Does anyone have a pointer or two for getting around this? Dialog with a properly-sized window: Dialog with a small window:

    Read the article

  • XPCOM support in Android webkit browser?

    - by Krish
    Does the Android WebKit supports the XPCOM framework or NPRuntime API`s as like Firefox? How to implement JavaScript in the Android WebKit plug-in? Update: I am writing a media player plug-in for the Android WebKit browser and my plug-in needs to get the command from the web page through JavaScript (some actions like play/pause/stop/resize are issued as JavaScript commands from the browser). My plug-in is written in native C code. Are there any examples or sample plug-in available for JavaScript communication?

    Read the article

  • How to refresh parent page using javascript / asp.net in mozilla firefox browser

    - by Rajesh Rolen- DotNet Developer
    window.opener.location.reload(); is working fine with IE but not refreshing parent page in mozilla firefox browser.. please tell me how to refresh parent page in cross browser. i have got this function : Shared Sub CloseMyWindow() Dim tmpStr As String = "" tmpStr += "window.open('','_parent','');window.close();" tmpStr += "window.opener.location.reload();" 'Dim currentPage As Page = TryCast(HttpContext.Current.Handler, Page) 'currentPage.ClientScript.RegisterStartupScript(GetType(me), "refresh", tmpStr, True) HttpContext.Current.Response.Write("<script language='javascript'>" + tmpStr + "</script>") HttpContext.Current.Response.End() End Sub

    Read the article

  • Stop browser from filling textboxes with details

    - by TenaciousImpy
    Hi, I've run into a really annoying problem, and I'm hoping it's just a setting I've missed. I've got an ASP.NET application which allows users to enter their username/password in various places (e.g. login, change password, change username etc..). When I logged in, the browser asked if I would like to store the user details. Usually, I click 'no', but this time I decided to click 'yes'. Now, certain textboxes in my form are prefilled with the username or password. Is it possible to remove these, as they sometimes appear in textboxes which shouldn't be prefilled. I tried setting AutoCompleteType=none and Text='' but it still gets prefilled. The textboxes don't have much in common, except the same CssClass and, for password boxes, TextMode=password. The names are different, although sometimes they include the word name (e.g. fullName, userName). Is there a way to stop the browser from filling certain textboxes? Thanks

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >