SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Zealot glowdot's Avatar
    Join Date
    Jun 2007
    Location
    Santa Monica, CA
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Embedding a javascript-heavy page in another page

    We have a system where you can upload photos, geotag them, and then view them on a Google map. A sample map is here.

    Recently we decided it would be cool if you could embed your map in a blog, SN profile, website... whatever. The problem is figuring out the best way to do that since a lot of sites block out javascript code and/or iframes.

    Currently, you can copy and paste some iframe code, which works fine enough on certain sites -- here it is on blogspot for example.

    But I want to give people options, so if the iframe doesn't work, maybe they could try some javascript. And if the JavaScript doesn't work, they could try... whatever else we can come up with.

    Any ideas what kind of code would be best here?

    The page linked to in the iframe simply outputs a couple DIVs -- one for the header message, and one for the map itself.
    Advertise on Glowfoto
    banners as low as $25/month, text ads $10/month
    Share 10 million impressions per month!

  2. #2
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    personally I think javascript/iframes are the only probable way. Only other way is to provide a link.


  3. #3
    SitePoint Zealot glowdot's Avatar
    Join Date
    Jun 2007
    Location
    Santa Monica, CA
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have been unable to figure out how to do this with javascript. Is there something like include(url) that we can use for this?

    The reason I am leaning away from the iframe and towards a javascript way is that

    1.) because it's google maps, it's already javascript, so I don't have to worry about whether someone has javascript turned on or not and
    2.) if they don't have javascript on, it won't work regardless of how we do it, but there is a possibility that they have javascript on by iframes disabled.
    3.) I think javascript may give us a bit more control over how big the map is. With the iframe method, we have to make the iframe a bit bigger than the DIV containing the map, and then cross our fingers.

    but again, I don't understand how to inject the output from one page into another.
    Advertise on Glowfoto
    banners as low as $25/month, text ads $10/month
    Share 10 million impressions per month!

  4. #4
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well first problem to look at is the API key for google maps. Iframes will allow you to continue using your own API Key but using javascript will then need a new API Key for the site your on.

    You could stick all the code that generates the map into an javascript file, and then include that on the page you want to show it on. Providing you create the file correctly, it should be ok, but again the API Key will cause problems.


  5. #5
    SitePoint Zealot glowdot's Avatar
    Join Date
    Jun 2007
    Location
    Santa Monica, CA
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by gRoberts View Post
    Well first problem to look at is the API key for google maps. Iframes will allow you to continue using your own API Key but using javascript will then need a new API Key for the site your on.

    You could stick all the code that generates the map into an javascript file, and then include that on the page you want to show it on. Providing you create the file correctly, it should be ok, but again the API Key will cause problems.
    Ah ok, that pretty much answers it then. If I need a new API key for every site a user might embed the map on, that obviously won't work.

    IFRAMEs it is then. Thanks!
    Advertise on Glowfoto
    banners as low as $25/month, text ads $10/month
    Share 10 million impressions per month!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •