1

I am writing a flex3 tool for our uber-geeks. The tool is for futzing around with sharing URLs to various various social sites.

private function submitRequest(evt:Event):void {

var requestURL:URLRequest = new URLRequest(constructURL());
requestURL.method=URLRequestMethod.POST;
var header:URLRequestHeader = new URLRequestHeader("og:title", "petertitle");
requestURL.requestHeaders.push(header);
navigateToURL(requestURL,"_blank");
}

I want allow the developer to manipulate the following meta headers in the outgoing html request when navigateToURL() is called.

<meta property="og:title" content=title" />
<meta property="og:description" content="description" />\
<meta property="og:image" content="......" />
<meta property="og:video" content="......"/> 
<meta property="og:video:height" content="640" />
<meta property="og:video:width" content="480" />

Unfortunately google is not showing me any example of how to add the above meta headers to my instance of URLRequest in flex. AND the new URLRequestHeader is blowing up.

ArgumentError: Error #2096: The HTTP request header og:title cannot be set via ActionScript.
at global/flash.net::navigateToURL()

Can someone point me at an example of putting the meta headers into a URLRequest?



additional

Looks like I am in a catch 22 situation. I wrote the app to run in a flash player.

  1. apparently the flash apps run from flashbuilder are not permitted to perfom http PUT method operations. it alwasy does GET
  2. flash apps run from flashbuilder will not write headers on http GET calls.

But I am still not finding a way to add an http "meta" header tag in flex... perhaps adobe air.

Current work around.

I can call an external javascript function that will do a post, but however the XmlHttpRequest infrastructure only want to setRequestHeader(key,value), and seems to need to be from a very specific list of strings. setRequestHeader("foo","bar") did not add a foo header in my outgoing request.

There does not seem to be a way to add the header meta tag. via javascript. Or at lease I am not finding it off of google.

Hoping someone can now point me at how to do that?????

ketan
  • 19,129
  • 42
  • 60
  • 98
peter cooke
  • 987
  • 3
  • 10
  • 28

2 Answers2

0

Do either of these help (appears the first one is particularly relevant, otherwise in the second a work-around is offered):

How can i send custom headers with URLRequest

Custom headers possible with URLRequest/URLStream using method GET?

Community
  • 1
  • 1
shaunhusain
  • 19,630
  • 4
  • 38
  • 51
  • the second is essentailly what I did. Also unforutunately the first neither works. the custom headers does not like the ":" on "og:XXXX", but even if I take out the colon. I am not getting "" – peter cooke Mar 08 '12 at 17:54
0

What a pain. I would have thought someone would have run into this before and posted such a solution

setRequestHeader(arg1, arg2) ouptputs "< arg1 arg2 />" in the outgoing http request so if I

 xmlhttp.setRequestHeader("meta","property=\"og:description\" content=\"description\"");

then the outing html

<head>
   ....
    <meta property="og:description" content="description"/>
   ....
</head>
<body>
....
</body>
peter cooke
  • 987
  • 3
  • 10
  • 28