Results 1 to 4 of 4

Thread: Javascript content to Url

  1. #1
    Join Date
    Mar 2007
    Location
    Austin, TX
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Javascript content to Url

    I have a client that has a web page that loads frame like content inside one page using Javascript:

    Code:
    <script language="JavaScript" type="text/javascript">
    function getFAQ(content) {
    	document.getElementById("faqdiv").innerHTML = faq[content];
    } 
    var faq=new Array()
    faq[0]= <h1>content</h1>
    
    <p><a href="javascript:void(0);" onclick="getFAQ(0);">text goes here</a></p>
    I would like the browser to load a separate url for each content page.
    Can someone help me?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You could use frames or iframe(s) or Ajax. Frames and iframes are rather standard HTML solutions and have the merit of not requiring javascript. Their use is well documented on the web. There are several Ajax scripts available here:

    http://www.dynamicdrive.com/dynamicindex17/indexb.html
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Mar 2007
    Location
    Austin, TX
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Ajax with URL Change and Backbutton

    What I was actually looking for was a way to use JavaScript, or Ajax, to dynamiclly display content and change the url and backbutton controls. So the user can copy the link for specific content, use the back button intuitively, and be seo friendly.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Er, no, XHR is not SEO-friendly. If SEO is a concern, you'd be better off (by far) using iframes. If it's not so much of a concern, XHR and server-side coding can be combined to elegantly display a full version of the page if the user doesn't have Javascript, or to strip the content and load it into your element if the user does.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •