You can only jumpseat on the flight deck of a U.S. airliner if you work for a U.S. airline and there is a reciprocal agreement between your airline and the company you are trying to jumpseat on. Additionally in order to ride in the flight deck you have to be cleared through the TSA's CASS system. At present time you cannot ride in the flight deck if you cross the border of the United States, although the TSA has signaled the intention to change the policy to allow flight deck access across the U.S. border at some point in the future. Interestingly it is not well known but CASS approved pilots can ride in the flight deck on flights operated outside of the United States - for instance I could ride in the flight deck on a United Airlines flight from Hong Kong to Singapore.
Even though the flight deck is not allowed when crossing the the borders of the United States, you can still ride as a "jumpseat" rider for free as long as you occupy a seat in the cabin. I ride as a jumpseater four to five times per year between Newark and Copenhagen on Continental.
Ultimately the decision to allow "jumpseat" riders in the cabin is the choice of the airline. For example at my company we allow Cathay Pacific pilots to "jumpseat" in the cabin, even though Cathay is not a U.S. airline.