SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2009
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript links and htaccess

    I have links that look like this in the browser:
    javascript:ajaxpage('piercing_gallery.php',%20'contentarea');

    Is there a way using htaccess or another method to make the above look more like: gallery.php or http://www.website.com/gallery.php
    AllTopExchange - Banner Ad Network
    40,000+ Free Impressions When You Join.

    TrinityClicks Best GPT Site EVER! Join Now!

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,862
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Not using .htaccess but you can (and should) recode your links so that they do display like you want.

    Replace the href="..." with a conventional http://www.erxample.com/gallery.php link and move the JavaScript into an onclick="..." where at least it will not break the page for 10% of your visitors.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Enthusiast
    Join Date
    Dec 2009
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can anyone help me accomplish a better way of doing this?
    http://www.dynamicdrive.com/dynamici...jaxcontent.htm
    AllTopExchange - Banner Ad Network
    40,000+ Free Impressions When You Join.

    TrinityClicks Best GPT Site EVER! Join Now!

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,862
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    <a href='test.htm' target='contentarea'>test</a>

    and drop all the JavaScript completely.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    SitePoint Enthusiast
    Join Date
    Dec 2009
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    <a href='test.htm' target='contentarea'>test</a>

    and drop all the JavaScript completely.
    That does not work. I am trying to target a div, ie:
    <div id="contentarea"></div>
    AllTopExchange - Banner Ad Network
    40,000+ Free Impressions When You Join.

    TrinityClicks Best GPT Site EVER! Join Now!

  6. #6
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,862
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by jwebdd View Post
    That does not work. I am trying to target a div, ie:
    <div id="contentarea"></div>
    |How are you handling it for the 10% of people without JavaScript?

    The simplest fix is to just replace the div with an iframe . Otherwise just use the href for the non-JavaScript version, move the JavaScript code into an onclick= and return false from that so it doesn't run the href.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


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
  •