Take the 2-minute tour ×

I'm trying to make a sort of map with data that overlays based on what a user selects. Currently, I just have the image on the same page shrunken, but it's rather hard to read. I was thinking I could have the entire image in an iframe and just have the user be able to scroll around the map, but Im not sure if I can use the javascript between the two pages. Would it be possible or do I have to figure out another way to get a full size image?


share|improve this question

2 Answers 2

up vote 2 down vote accepted

If the two pages are on the same domain, then you will be able to transfer information between them. If not, there are still ways to transfer JSON data between domains (using JSONP) but it will be much harder.

share|improve this answer
And how would I reference that? –  NatFan9 Nov 17 '12 at 21:00
Some info on using postMessage (check the compatibility of this method) benalman.com/code/projects/jquery-postmessage/examples/iframe –  bmarti44 Nov 17 '12 at 21:11
Simpler way to communicate between the 2 windows stackoverflow.com/questions/4601325/… –  bmarti44 Nov 17 '12 at 21:12
Info on Same Origin Policy and why you can't (easily) do cross domain data stackoverflow.com/questions/2538215/… –  bmarti44 Nov 17 '12 at 21:15
I read both, and I still dont really get how i would reference an object. They are on the same domain, but I take it it's still not as easy as something like document.getElementById("button").src –  NatFan9 Nov 17 '12 at 22:06

Yes you can. In fact, you can call functions in one javascript file that only exist in another (provided you add them in the right order).

If you aren't in the same domain, you can use JSONP to freely send cross-domain requests back and forth.

jsonp with jquery

share|improve this answer

Your Answer


