Solved

unexpect base tag behaviour

Posted on 2000-05-10
12
186 Views
Last Modified: 2012-05-04
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
Comment
Question by:winkle
  • 5
  • 4
  • 2
  • +1
12 Comments
 
LVL 8

Accepted Solution

by:
jbirk earned 200 total points
ID: 2798893
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
 
LVL 22

Expert Comment

by:CJ_S
ID: 2799139
how about just getting rid of the base  in the cgi-script?
0
 
LVL 4

Expert Comment

by:rafistern
ID: 2799723
or if you are working with some kind of tamplate, putting the <base> inside comments.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:winkle
ID: 2800961
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
 
LVL 22

Expert Comment

by:CJ_S
ID: 2801314
You should talk with the programmer about that.
0
 

Author Comment

by:winkle
ID: 2801385
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
 
LVL 8

Expert Comment

by:jbirk
ID: 2801410
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
 
LVL 8

Expert Comment

by:jbirk
ID: 2801423
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
 
LVL 8

Expert Comment

by:jbirk
ID: 2844489
How's it coming on this winkle?  Did you figure it out?
0
 

Author Comment

by:winkle
ID: 2846868
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
 
LVL 8

Expert Comment

by:jbirk
ID: 2847656
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
 

Author Comment

by:winkle
ID: 2847674
Comment accepted as answer
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now