Solved

unexpect base tag behaviour

Posted on 2000-05-10
12
190 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 

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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

617 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