My understanding is that the Japanese defeat at Midway is was what actually scrapped their plans, with Hawaii being the next target, and eventually the US mainland. But I've also heard arguments that gun ownership was also a contributing factor in deterring mainland invasion plans. Is this a fable or fact?
So first off, no the IJN never had a single plan to land troops in California or the West Coast.
Most planning officers in the command didn't really even want to do the Aleutians. And the few times that any ideas of landing troops in Hawaii was brought up it was literally laughed off as ridiculous.
Even rumors of Yamamoto wanting to go past Midway to say Johnston Island or Samoa got the Army and parts of the Navy so worried about his crazy plan that he had to officially rule them out for resources to be contributed.
Many officers even doubted their ability to hold Midway if they took it. It was so far away, and so desoltate that everything would have to be supplied by ship. The Japanese merchant marine was too small at the start of the war, and was cracking under the weight of maintaining the empire and supplying everything and everyone that needed it already in the summer of 1942. And that is well before the submarine effort took off.
Parshall and Tully, the authors of the top modern book on Midway help debunk here a lot fo the problems on why Japan never ahd a shot and never even planned for an invasion of Oahu: http://www.combinedfleet.com/pearlops.htm
Suffice to say the large garrison of US troops. Huge supply chain requirements of even supplying an attacking force smaller than the defendingon, and general lack of any doctrine for conducting opposed landings from the sea, speak heavily against Japan's ability to even have taken Midway if they had won the battle.
Japan didn't want an American empire, they wanted the Southern Resource area, and they planned simply on having a series of interprotected islands to serve as a bulwark in the expanse of the Pacific to bleed US forces dry. And thus in the end it was the reality of space, time, and economics, helped by the US Navy that stopped Japan's advance.
EDIT: TO also clarify, Midway wasn't really targeted for its location by the IJN, Yamamoto paid lip service to allowing patrol planes to monitor and harass, but the single reason the battle took place was the continued existence of the US Carrier forces. Yamamoto saw them as the single greatest remaining threat to Japan, and was deeply embarrassed personally by the Doolittle Raid. Thus he sought to force them to defend and fight near a target they couldn't surrender without a defense. Which he accurately picked to be Midway.
Would Midway have been targeted otherwise? Perhaps in time, but it is important to note that the huge shift in priority upset already in motion plans to secure the area around New Guinea, and the destruction of the base at Port Moresby. Whicht he Army protested couldn't be put off, leading to Yamamoto splitting the carriers to give the older ones time to prepare for Midway, and sent the Shokaku and Zuikaku to the Coral Sea to appease the Army in return for their support in Midway.