开发者

using var i=new Image(); i.src... instead of true ajax for signal only remote commands

开发者 https://www.devze.com 2023-03-20 18:08 出处:网络
how effective is: var i=new Image(); i.src=\'http://secondary.domain.com/command.gif?command=somecmd&rand=\'+....epoch time....;

how effective is:

var i=new Image();
i.src='http://secondary.domain.com/command.gif?command=somecmd&rand='+....epoch time....;
... mod_rewrite the above url to php script ...

as a way to get around crossdomain restrictions for '1 way only' style ajax commands.

we have a bunch of commands that always return 204 anyways. so we were thinking of moving these onto another box.

how much faith can we have in the browser hitting the image even if we dont render it.

anyone know any crossbrowser issues with this off hand?

开发者_运维问答

would it be better to actually render a 1px/1px image somewhere in the dom to make sure the image gets hit?

session based stuff already taken care of using memcached and setting the cookie to .domain.com.

thanks!


I would suggest using JSONP instead of this method. Check out: http://en.wikipedia.org/wiki/JSONP. You don't have to worry about rendering a script tag.

0

精彩评论

暂无评论...
验证码 换一张
取 消