Not necessarily
from here
there's a but (of Coco sized proportions).
So yes a ref or linesman would flag it up as offside. Plus the general rules of obstruction and unsportsmanlike like behavior would mean that the above tactic would not be allowed.
You don't try and disprove Troll Physics as well, do you? C'mon guy, it's meant to be funny. I don't watch soccer and even I know you can't REALLY do that.