/    Sign up×
Community /Pin to ProfileBookmark

I’m linking from one document to another document’s anchors. The document being linked to makes use of the “include” method and the anchors are on the included document.

Safari won’t go to the target anchor for whatever reason. I’m doing this on a basic print(”) level.

Can anyone suggest a decent workaround to solve this? I’m thinking that the anchors aren’t loaded in time to catch the load command from Safari.

to post a comment
PHP

9 Comments(s)

Copy linkTweet thisAlerts:
@robindeanauthorMar 12.2007 — Anyone?
Copy linkTweet thisAlerts:
@LeeUMar 12.2007 — It will help if you post the script.
Copy linkTweet thisAlerts:
@NightShift58Mar 12.2007 — It must be something else.

Safari doesn't "load" anything. Your web server is the one doing all the loading (of included files) and it serves the complete HTML document to Safari.

You may have a path problem when referencing the document directly - or some other issue but I don't think that the browser is "guilty".
Copy linkTweet thisAlerts:
@robindeanauthorMar 13.2007 — The script is pretty big but I'll try to find some code worth reading. Please respond to the following comment first, if you're up for it. Then I'll throw the code up ...

Everything works fine in other bowsers. It's only in Safari that I'm having trouble.

The targets are article titles being linked to by article titles, so there spaces (url.com/page.html#This Article Title With Spaces In It).

further more, it works when directly linking to the source instead of the parent (uses include method) document.
Copy linkTweet thisAlerts:
@NightShift58Mar 13.2007 — There shouldn't be any spaces in your URL's, so use urlencode() before you add the article titles to the URL. Each browser has its own rules for dealing with unencoded URL and you can't rely on that. That could be the problem.
Copy linkTweet thisAlerts:
@robindeanauthorMar 13.2007 — can you give me an example as to how to use urlencode()?
Copy linkTweet thisAlerts:
@robindeanauthorMar 13.2007 — Well, before delving into url encode, I opted to change the #tags to something that is already easy to work with ... namely #yyyymmdd (year, month, date) without any separators.

These appear as 20070313, for example ... easy enough.

Even then they don't work, so I'm posting my code.

first, content.php?display=home renders the following:

if ($display == "home") { include ("news.php"); }

news.php, in it's entirety, is as follows:

<?php

if ($display == "home")

{

print ('<span class="purple"><br><a href="#" class="blue" onclick="GetPage('content.php?display=news#20070209','self'); return false;"><b>Live Webcasting Active Through Stickam</b></a> - posted <script language="javascript">PostDate('20070209');</script><br><a href="#" class="blue" onclick="GetPage('content.php?display=news#20070113','self'); return false;"><b>Sonicbids Hosting Promotional Materials</b></a> - posted <script language="javascript">PostDate('20070113');</script></span>');

}

else if ($display == "news" && $archive == null)

{

print ('<a name="20070209"></a>content A<br><br><a name="20070113"></a>content B');

}

else if ($display == "links")

{

print ('var archives = new Array();

archives[archives.length] = new Array('content.php?display=news&archive=http://www.robindean.com/archive/2007-2008/2007_01_13_archive_news.php', '01.13.2007'); archives[archives.length] = new Array('content.php?display=news&archive=http://www.robindean.com/archive/2007-2008/2007_02_09_archive_news.php', '02.09.2007');

for (var i=archives.length-1;i>=0;i--)

{

document.write('<option value="' + archives[i][0] + '">' + archives[i][1] + '</option>');

}');

}

else if ($display == "news" && $archive != null)

{

print ('archive content');

}

else print ('alternative content');

?>



Next, a person clicks on the content.php?display=home link which points to content.php?display=news and renders the following active (code on content.php):



if ($display == "news")

{

if ($archive == null)

{

include ("news.php");

}

else include $archive;

}



If you do a page search for "content A" or "content B" you'll see where the target content is to appear with anchors. I cut the bulk of the content out to fit into this post.



Let me know where I'm going wrong here :o
Copy linkTweet thisAlerts:
@robindeanauthorMar 13.2007 — I've found the source of the problem. There's a bug in connection with CSS and anchors for Safari.

Researching in different area. Thanks regardless!
×

Success!

Help @robindean spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...