Reputation: 1
So this it it I've been trying all day to use javascript or jquery to set my page's background to the same background of whatever page is the referring url so far this is what I have
<script>
var xyz=document.referrer;
var urz=xyz.body.style.backgroundImage;
document.body.style.backgroundImage = urz;
</script>
Any help would be greatly appreciated!
Upvotes: 0
Views: 1178
Reputation: 1196
Short answer is: This cannot work since document.referrer
is a URI, not the referring document.
In theory, you could load that page (again) and do a lot of magic to obtain its background image. In general however (i.e. if the referrer can be any page), you won't be able to load it from Javascript anyway due to all kinds of security restrictions.
If in your use case you are in control of the referring page it is probably best to find a different solution to pass that information to the navigation target, but you would have to be more clear on your use case.
Upvotes: 1