Despite the success of Maxwell's electromagnetism in the description of the electromagnetic interactions on small scales, we know very little about the behaviour of electromagnetic fields on cosmological distances. Thus, it has been suggested recently that the problems of dark energy and the origin of cosmic magnetic fields could be pointing to a modification of Maxwell's theory on large scales. Here, we review such a proposal in which the scalar state which is usually eliminated be means of the Lorenz condition is allowed to propagate. On super-Hubble scales, the new mode is essentially given by the temporal component of the electromagnetic potential and contributes as an effective cosmological constant to the energy-momentum tensor. The new state can be generated from quantum fluctuations during inflation and it is shown that the predicted value for the cosmological constant agrees with observations provided inflation took place at the electroweak scale. We also consider more general theories including non-minimal couplings to the space-time curvature in the presence of the temporal electromagnetic background. We show that both in the minimal and non-minimal cases, the modified Maxwell's equations include new effective current terms which can generate magnetic fields from sub-galactic scales up to the present Hubble horizon. The corresponding amplitudes could be enough to seed a galactic dynamo or even to account for observations just by collapse and differential rotation in the protogalactic cloud.