Solved

unexpect base tag behaviour

Posted on 2000-05-10
12
184 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
Comment Utility
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
Comment Utility
how about just getting rid of the base  in the cgi-script?
0
 
LVL 4

Expert Comment

by:rafistern
Comment Utility
or if you are working with some kind of tamplate, putting the <base> inside comments.
0
 

Author Comment

by:winkle
Comment Utility
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
Comment Utility
You should talk with the programmer about that.
0
 

Author Comment

by:winkle
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 8

Expert Comment

by:jbirk
Comment Utility
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
Comment Utility
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
Comment Utility
How's it coming on this winkle?  Did you figure it out?
0
 

Author Comment

by:winkle
Comment Utility
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
Comment Utility
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
Comment Utility
Comment accepted as answer
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

743 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