Define custom User-agent header in the HTTP request? - iphone

I would like to get a glimpse of web-sites created for iPhone devices. In order to be able to view those sites I have to modify the User-agent header in the HTTP request that my browser sends. That way I can trick the web-server into believing that my browser is an iPhone browser, and then the web-server would send my the iPhone version of the web-site.
So, how can I modify the User-agent header that my browser sends in each HTTP request.
Maybe there is an Firefox plug-in that allows modifying request headers?
Also, I think I heard that Safari allows that somehow....

You can try the user-agent switcher plugin.

Yeah you can do this with Modify Headers add-on for Firefox.

First, there's the following plugin: https://addons.mozilla.org/en-US/firefox/addon/59/
Also, there's Firefox configuration: type "about:config" as URL in Firefox, find general.useragent.* properties there.

You don't need a browser add-on in order to add a custom User-Agent string in your HTTP header. Chrome has added this feature to developer tools.
Open the developer tools and click on the Toggle Device Toolbar option or press cmd+shift+M to open it. You can select a device user agent from the presets or you can also define a custom device like mentioned in the below screenshot.

Related

View the response body of a COMET event with Chrome Developer Tools

Is it currently possible to view the body of the message being sent by a COMET event using Chrome Developer tools? I'm simply looking at COMET Clock sample here by Play Framework - http://www.playframework.com/documentation/2.2.x/Samples. When I enable the developer tools and go to the event-stream object, I can only see the request and response headers. No body or message can be viewed anywhere. Is this currently even possible? Nothing shows up under WebSockets, but I'm fairly sure this example is not using WebSockets, so that makes sense.
No. It is not possible for HTTP streaming (which I think it is your case) as March 2014 (hopefully they change this in the future)
Google Devtools only shows the response when the connection is closed.
In the case of web-sockets you do see live data.
But! modern versions of Firebug can show live data streaming. So I recommend you get Firefox and install the Firebug addon.
((Ahh firebug, it used to be all we had. Poor forgotten guy. But it still has nice things Chrome lacks!))
Cheers.
You can inspect the response from any HTTP request using the DevTools Network tab. To make finding your Comet request easier, select the XHR filter button at the bottom of the Network tab panel. You may need to reload the page after opening the Network tab to refresh the list of requests. Sometime it is necessary to switch back and forth between the All and XHR filters to see new requests that have been initiated since selecting the XHR filter. Once you have identified the request item, click to select it. On the right panel choose
Response from the taps at the top

Simulate iPhone environment in Firebug

Is there a way I can get Firebug or Firefox to send an iPhone user agent string to the browser, so I can debug the iPhone layout of my site more easily?
Thanks,
Kevin
Search for a User-Agent switcher extension and install that. One option is User Agent Switcher.
More generally, you can look for an extension to let you manipulate generic HTTP headers, which would of course include the User-Agent. It looks like Modify Headers is up to this task.
Try User Agent Switcher! Then set your user agent to whatever you like, in the tools menu.

Chrome NPAPI method for making it downloading url

I've recently got into using FireBreath for some simple task: download a clicked url. Is there a built-in method or something else with which i can add the url to Chrome's native download queue? or at least load up a Save Link As.. dialog (that would be ok too)?
You can show a save dialog by using the native OS calls to do so; for example, on the Mac you'd use NSSavePanel. That won't hand the download off to the browser though, it would just give you a user-selected filename to download to. You'd still have to do the download yourself.
NPAPI doesn't have a way to tell the browser to start a download using its UI. That would be something that would be an extension API if it existed (and what you'd want to file a request for if it didn't), not part of NPAPI.
Send the following HTTP header along with the content.
Content-Disposition: attachment
Optionally with ; filename="filename here".
If you want to download a clicked URL with FireBreath then you're not going to get a download dialog; if you need a download dialog, why are you using FireBreath?
The easiest way to get a download dialog is to set window.location to the URL you want to download and wait for the browser to pop the dialog up itself; you can do this with FireBreath or with javascript, it works the same way.

Not able to open the web page while runing test from Selenium

When i run my scripts as Junit test case, the browser opens up and also tries to open the provided URL. But, only the header and footer of the website is opened with the message "Cookies and Javascript Required
In order to correctly view this website, you will need Cookies and Javascript enabled on your browser. To set your browser to support these requirements, please visit your browser's help menu for the appropriate instructions."
This makes the entire script to fail as the Web elements are not displayed.
You need to provide some more information:
Does this behavior happen when you access the site normally i.e. without Selenium RC involved?
Which browser are you using?
Have you tried another browser? You can do that by changing the parameters in this line:
seleniumId = new DefaultSelenium( "localhost", 4444, "*iexplore", "http://URL");
(A useful trick is to put garbage in the browser parameter and when you run it, the error message shows all the allowable browser strings.)
Have you tried to enable cookies and Javascript? What happens then?
If you don't want cookies and Javascript enabled normally and you are using FireFox, you can set Selenium RC up to use a special proxy that does allow this (but only for Selenium tests). See here

How do I embed openads (Openx) ads in an iPhone application

I have tried using iframe, javascript and image tag Ad tags in iPhone application, but none of them work. When a user clicks on an image, the browser is launched but then nothing happens (you get a blank page). Anyone know how to proceed?
To proceed: debug it. A standard OpenX click URL will do a redirect. What URL is the browser sticking at?
I don't know anything about iPhone applications, but I do know about interfacing to OpenX. You possible should consider using the OpenX API, which will allow you to pull all the information you need into the 'back end' of your application, then use it as you need.
Proplem in iphone must be active enable java in iphone safari settings