• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • Last Modified:

unexpect base tag behaviour

I have a CGI that reads an HTML file (freqently not written inhouse) up to the browser via stdout. The problem is that for the resulting page a BASE is being set to the path of the cgi that's generating the display. This is causing links on the resulting page to no longer work.

Basically...

page 1 - has links of general form "cginame?inputArgs_out.htm"

this results in out.htm being written to the browser over stdout.

out.htm can have relative locations in it (both links, and graphics). I need for these  hrefs and img tags to work.

I'd like to avoid having to read all the links and insert the appropriate base in them (i.e. find <a href='2nd.htm'> and change it to <a href='www.dummy.com/2nd.htm'>.

Is there a way to do this?

As an aside, if I do a view source in Netscape 4.6 it appears as though a base tag has been dumped in for me.

Thnaks
0
winkle
Asked:
winkle
  • 5
  • 4
  • 2
  • +1
1 Solution
 
jbirkCommented:
I believe just using:
<BASE HREF="www.dummy.com">
should work for you.  Did you say that it's already putting a line like that in there?  Did you write the cgi, or is it someone else's code, and do you have access to the cgi code?

-Josh
0
 
CJ_SCommented:
how about just getting rid of the base  in the cgi-script?
0
 
rafisternCommented:
or if you are working with some kind of tamplate, putting the <base> inside comments.
0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
winkleAuthor Commented:
This extra base target is being generated by (I'm told by the person in charge fo the pages I'm working with) Netscape. I have no control over it. In other words, there is a base tag (that is being set to my cgi) that's being added by something OTHER than my cgi. What I've been told is that it is the browser that is adding it.

There have been cases where I've been able to add a base tag in the Head tag and the one I added overrode the one added by the browser. However, there was one case where added a proper base tag caused a problem. I'd like to know if I can turn this feature off.

0
 
CJ_SCommented:
You should talk with the programmer about that.
0
 
winkleAuthor Commented:
So the general answer is that the proper thing to do is to add a correct BASE tag to the HEAD tag of the web page I'm displaying? That should override the tag being put in by the browser?
0
 
jbirkCommented:
Is your cgi-script outputing valid html?  In what circumstances exactly is it adding it's own base tag?  I haven't seen this behavior before so I'm curious.  Are you sure it's the clients browser, and not something else on the server perhaps?  Also, what base is getting set (where does the browser pick as it's base for the document)?

I think I remember seeing that if you choose to download for offline viewing, or something like that the browser would add a base tag, but that's the only circumstance that comes to mind right now...

-Josh
0
 
jbirkCommented:
My comment was being written when your last one came in winkle...  sorry about that.  To answer that last question, yes, I should think that specifically outputting that from your cgi-progam would fix the problem.

-Josh
0
 
jbirkCommented:
How's it coming on this winkle?  Did you figure it out?
0
 
winkleAuthor Commented:
Sorry, we lost internet access for a while.

Adding a base tag a the end of the generated head tag (It just didn't seem the optimum solution.) does appear to override the base tag being dropped in by the browser.

jbirk noted that this hadn't been seen before...I hadn't either, but in Netscape the extra tag is visible on the page generate by my cgi, if you do a view source on the generated page. It's in front of the first line of HTML that my cgi writes. I assume that IE is inserting it as well (though you don't see it when you view source) based on the behaviour.

I'm not sure how to close out this question since it seems to have been a discussion that led to agreement on my guess of how to deal with the situation was probably the best thing to do.
0
 
jbirkCommented:
It's ultimately up to you who gets the points, but you should award them to someone (the person you feel helped you the most).  If you want to award points to a second expert for help on this question, open a second question titled "for expertname".(fill in expertname with the appropriate expert name of course:)

-Josh
0
 
winkleAuthor Commented:
Comment accepted as answer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

  • 5
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now