SetRequestHeader not working in air app?

Most of this is sample code. What I'm doing here is trying to pass the user agent http header but it is not doing the trick
I was trying this in a larger project but created a small project to test this
What are the limitations of this function?
I also tried setting cookie headers
req.setRequestHeader('Cookie', 'test=test');
but didnt have any luck
function doRequest(url) {
               var req = new XMLHttpRequest();
               req.onreadystatechange = function() {
                    if (req.readyState == 4) {
                        var str = req.responseText;
                        if (str.length > 800) {
                            str = str.substring(0, 799);
                            str += "..";
                        alert('readystate: ' + req.readyState + '\n' +
                            'status/statusText: ' + req.status + '/' +
                             req.statusText + '\n' +
                            'responseText (400 chars): '  + "\n\n" + str);
                req.open('GET', url, true);
    var agent = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008100922 Ubuntu/8.04 (hardy) Firefox/3.0.3";
        req.setRequestHeader('User-Agent', agent);
        req.send(null);           

Hi,
Both Header and Cookie are special headers and they can be handled separately. For other custom headers, your code should work via the req.setRequestHeader ('header_name', 'value');
For the header, please refer to this: http://help.adobe.com/en_US/AIR/1.5/devappsflex/WS5b3ccc516d4fbf351e63e3d118666ade46-7e7b. html
Basically use:
     htmlLoader.userAgent = agent;
instead of
    req.setRequestHeader('User-Agent', agent);
For cookie header, you need to instruct the htmlLoader to not handle the default cookie jar (which means sending the default cookies associated with a url). Please refer to manageCookies property: http://help.adobe.com/en_US/AIR/1.5/jslr/flash/html/HTMLLoader.html#manageCookies
You need to call this:
     htmlLoader.manageCookies = false;
before
     req.setRequestHeader('Cookie', 'test=test');
Best regards,
Dragos Georgita | Adobe AIR Engineering

Similar Messages

  • Css not working in AIR app?? Help Please :(

    Hi Everybody,
    Really hope someone can help with this as I can't find the solution to save my life.
    In my css file I have:
    #map2{
        border-color:red;
        border-style:solid;
        border-width:1px;
        height:130px;
        width:84%;
        float:right;
        vertical-align:middle;
    In my HTML file I have:
    <div id='map2'><input type="text" name="search"><input type="submit" value="search blog"><input type="submit" value="search web"></div>
    The css and HTML are woring fine together apart from the 'vertical-align:middle'??
    I have no idea why this is not working and I have looked all over the internet, can anyone out there help with this, PLEASE!!
    Thank you all in advance
    IrishAIRMax

    vertical-align doesn't work like you think it should. Read this page:
    http://phrogz.net/CSS/vertical-align/index.html

  • Add to Address Book not working in mail.app

    On all my computers : MacBook Air and Mac Mini, the Add to Address Book (command + Shift + Y) is not working in Mail.app.
    It doesn't add the email and name in the Address Book (now called Contact).
    Is this a broken link ?
    Best. StG

    Hey Saint-Georges -
    I've got the same issue in the console.  I didn't notice the keyboard shortcut not working but that's happening to me as well.  
    I've gone gone through and repaired the disk and disk permissions.  Still no luck.
    Hopefully someone has a fix.
    Rob
    From the Console:
    6/3/13 5:27:53.922 PM assistantd[4667]: <Error>: Daemon - Sync chunk denied! Canceling sync. [SASyncChunkDenied
      aceId: "26234165-b039-4219-af4d-8f4fa5561ebd"
      properties:
        callbacks: <empty array>
        errorCode: 0
      group: "com.apple.ace.sync"
      refId: "3274A842-6638-4E54-AFB3-F669BCCED462"
      v: "1.2"
      class: "ChunkDenied"]

  • -webkit-box-shadow not working on Air

    -webkit-box-shadow not working on Air anyone know why that
    is?
    It works on Safari but if I add it to my Html/Ajax app in air
    its no go.

    It's not on the list of webkit CSS properties supported in
    AIR:
    http://livedocs.adobe.com/air/1/devappshtml/AboutHTMLEnvironment_3.html

  • My "update all" buton will not work in the app store.  It gives me a message saying there is not enough storage to update.. I know i have storage left on the phone.  I even bought more icloud storage.  Any ideas??? Please help??? thanks

    My update all button will not work in the app store.  It keeps giving me a crazy message about not having enough storage to update apps.  Please help? I know i have storgage on icloud and on the phone itself.  Any ideas? Thanks

    Try deleting the old backup.
    Settings>iCloud>Storage & Backup>Manage Storage, tap the device name and on the resulting screen, scroll down and tap on Delete Backup.

  • Mail is not working. The app opens because I see a light on under "Mail" in the dock.

    Mail is not working. The app opens because I see a light on under "Mail" in the dock, and I see the menu at the top of my screen, but I don't see the app itself or any windows. It is like it is running in the background, but I can't see it. Everthing is subdued when I click on the choices up in the menu. I have tried "Force Quit" and then re-opening the mail app several times, and have rebooted my notebook twice. What is weird is that this started right after I changed my password in a browser (it is a gmail account). I went into the System Preferences on my MacBook and changed my password there as well, so it should be setup properly to open. I am running Mac OS X Lion 10.7.5.   Any help anyone can provide is much appreciated.

    The current Mail version for 10.6.8 Snow Leopard is 4.6 (1085).   Run Software update or the combo updater ... Mac OS X 10.6.8 Update Combo v1.1

  • HT1368 My wishlist is not working on the app store i can not find the add to wishlish icon but it is working fine with the itunes store so i am able to add films and music but not apps does anyone know how to fix this

    My wishlist is not working in the app store on my ipad it is woking fine in itunes store so i can add films and music but the icon "add to wish list" is not available on the app store so does anyone know how to fix this 

    The wish list only works on apps you have to pay for. To get it tap the icon of the app you want to save. After it opens at the upper right corner is a box with a arrow. Tap that then tap add to wish list list in the box that opens.

  • Hello, my iphone 5s fell, thereafter i tried taking a picture, the camera app just shows a black screen and hangs, the front camera works on other apps but the rear camera is not working, all other apps work perfectly well, how do i resolve this

    Hello, my iphone 5s fell, thereafter i tried taking a picture, the camera app just shows a black screen and hangs, the front camera works on other apps (such as facetime and skype) but the rear camera is not working, all other apps work perfectly well, how do i resolve this

    Double tap Home button and delete Camera app from multitask-list.
    Do a
    Reset: Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Note: You will not lose any data
    If problem persist, make an appointment with genius bar for evaluation.

  • [svn] 3913: BLZ-272 Two long polling endpoints not working in same app with Firefox

    Revision: 3913
    Author: [email protected]
    Date: 2008-10-27 13:49:02 -0700 (Mon, 27 Oct 2008)
    Log Message:
    BLZ-272 Two long polling endpoints not working in same app with Firefox
    The long polling waitMonitor object in the FlexSession did not keep track of
    blocking polls via endpoint ID. This prevented the second channel from blocking.
    Enhance the FlexSession.waitMonitor to be a map of endpointID to
    EndpointQueue objects, and keep track of the monitors based on what endpoint
    they are associated with.
    QA: Yes
    Doc:No
    Checkintests: passed
    Ticket Links:
    http://bugs.adobe.com/jira/browse/BLZ-272
    Modified Paths:
    blazeds/branches/3.0.x/modules/core/src/java/flex/messaging/FlexSession.java
    blazeds/branches/3.0.x/modules/core/src/java/flex/messaging/client/FlexClient.java

    Revision: 3913
    Author: [email protected]
    Date: 2008-10-27 13:49:02 -0700 (Mon, 27 Oct 2008)
    Log Message:
    BLZ-272 Two long polling endpoints not working in same app with Firefox
    The long polling waitMonitor object in the FlexSession did not keep track of
    blocking polls via endpoint ID. This prevented the second channel from blocking.
    Enhance the FlexSession.waitMonitor to be a map of endpointID to
    EndpointQueue objects, and keep track of the monitors based on what endpoint
    they are associated with.
    QA: Yes
    Doc:No
    Checkintests: passed
    Ticket Links:
    http://bugs.adobe.com/jira/browse/BLZ-272
    Modified Paths:
    blazeds/branches/3.0.x/modules/core/src/java/flex/messaging/FlexSession.java
    blazeds/branches/3.0.x/modules/core/src/java/flex/messaging/client/FlexClient.java

  • Updates tab not working in the App Store

    The updates tab is not working in the App Store. I have to go to purchased tab to find the apps that need updating. How can I fix this? I've turn off the iPad multiple times hoping it will reboot but it doesn't help.

    Apparently there are problems updating updates on iOS devices >  Apps update not working. Was before but...: Apple Support Communities
    Try again later or tomorrow.
    It's been reported to Apple.

  • HT4262 WI-Fi not working says air port not configured

    Wi-fi not working says air port not configured, help]

    Life is getting more complicated to do support..
    You need to tell us what version airport.. extreme or express and the model number. A1xxx from the label.
    You need to tell us OS.. if the profile which says 10.6.8 is wrong.. as that is confusing.
    The new AC version Extreme needs 6.3 version airport utility which is only available for Lion or mountain Lion.
    You might also need to turn on ipv6 local-link to get it to show in the utility.

  • Geolocation on Geeksphone not working at neither app

    I wrote an app, that worked fine in simulator. Get the self position with geolocation and put markers on map. But on Geeksphone geolocation not working on this app, Here maps or if i just simple go to google maps.

    Your best bet is to ask on the #gaia or #b2g channels on IRC.
    *see: https://wiki.mozilla.org/Irc

  • HT4623 my apple i pad is currently not working and no apps are opening  pls clarify it

    my apple i pad is currently not working and no apps are opening  pls clarify it

    Are there any error messages?
    Knowing what you see or are experiencing can help diagnose it.
    In the meantime, a common fix, hold down the sleep and home keys for about 20 seconds and see if you can force it to rebood. If you see a silver apple, let go and let it reboot and see if that helps.

  • Apple id not work for mac app store, what happen? It is available for others such as iTunes, my iPhone and iPad

    apple id not work for mac app store, what happen? It is available for others such as iTunes, my iPhone and iPad

    Try deleting the cache associated with the App Store..
    Quit the App Store if it's open.
    Open the Finder. From the Finder menu bar click Go > Go to Folder
    Type this exactly as you see it here:
    ~/Library/Caches/com.apple.appstore/Cache.db
    Click Go
    Move the Cache.db file to the Trash.
    Relaunch the App Store. See if that made a difference.

  • 1st think my billing info is not support debit card not support by apple 2nd think is my old I'd is not working even free app in app store......

    1st think my billing info is not support debit card not support by apple 2nd think is my old I'd is not working even free app in app store......

    1st think my billing info is not support debit card not support by apple 2nd think is my old I'd is not working even free app in app store......

Maybe you are looking for

  • Dynamic create Component usage and embed it in view container

    There is a view_container_uielement VC_TEST  in view V_MAIN, in wd component ZTEST. I created a web dynpro component named ZWDR_TEST and add it into the wd component ZTEST.     gr_comp_test = component->create_cmp_usage_group(       name = 'TEST_GROU

  • Delete more than 1 photo at a time

    I am trying to clean up my bosses Iphoto libary.  Is there a way to delete more than one photo at a time?  If I were on my PC (I know...  bad word... sorry) I would hit control and then click the photos that I want to delete then hit delete.  I can't

  • Printing PDF :(

    Product name and Number: HP LaserJet Pro 100 Operating System: Windows 7 Hello every one, i have just booth a HP LaserJet Pro 100 m175nw beautiful printer The problem is when I print pdf files so the entire text is moved down? both header and body te

  • TS3991 wrong name is displayed in account

    hi         my icloud account name is shows wrong by displaying prabu vs instead of karthik

  • System Exec output

    The example below ilustrates the problem I'm having. What I want to do is run an Executable, Wait until done. But the issue I have is when I run the wait until done with the flag to True the output is blank until it completes. When I runn it with the