WinBatch® Technical Support Forum

All Things WinBatch => WebBatch => Topic started by: JTaylor on June 09, 2017, 01:04:59 PM

Title: Redirect
Post by: JTaylor on June 09, 2017, 01:04:59 PM
Hopefully I haven't overlooked anything and not sure if I have requested this feature before but looking for a direct way to redirect from a ".web" file to a new address like PERL does with

    print $query->redirect($url);

I know of at least one way to get there but a bit clunky.   Having a WebBatch function would be GREATLY appreciated.

Thanks.

Jim
Title: Re: Redirect
Post by: td on June 09, 2017, 01:36:23 PM
Ever tried to WebOut a 303 header?

HTTP/1.1 303 See Other
Location: http://whatever.org/index.html
Title: Re: Redirect
Post by: JTaylor on June 09, 2017, 01:39:46 PM
No.  I generally use this method.   Any advantage with the 303?   Any chance of a WebOutRedirect() function?

Jim

Code (html5) Select

<head>
<meta http-equiv="Refresh" content="0;url=https://www.w3schools.com">
</head>
Title: Re: Redirect
Post by: td on June 09, 2017, 10:49:49 PM
A 301 or 303 is handled at the http protocol level which means it should require less overhead and be more efficient than an html header.   I would be very surprised if your PERL "redirect" did anything more than issue a http 301 header.
Title: Re: Redirect
Post by: JTaylor on June 10, 2017, 07:45:13 AM
Okay.  Thanks.   If you get bored and are looking for something to do, having something like that as a function would be nice though :)

Thanks again.

Jim
Title: Re: Redirect
Post by: td on June 10, 2017, 08:33:05 AM
An experienced software architect would say that loading up a product with trivial functions doesn't improve the product for users.  It does quite the opposite.  What it apparent is that an effort needs to be made to restore the solution sharing community that the old WebBoard once was. 

Code (winbatch) Select
;;; redirect.web

; Could be any 30x redirect depending on need.
WebOut('HTTP/1.1 303 See Other':@CRLF:'Location: http://www.winbatch.com/index.html',2) ; 2 required to indicate a header end.
Title: Re: Redirect
Post by: JTaylor on June 10, 2017, 08:48:20 AM
I agree on both points.    I try not to ask for the first and to do my part on the second.

Guess I didn't see it as trivial.   There is WebOutFile so thought WebOutURL would be appropriate as well.

In any event, thanks.

Jim
Title: Re: Redirect
Post by: td on June 10, 2017, 01:40:30 PM
Code (winbatch) Select
#definefunction WebOutRedirect(_url)
   return WebOut('HTTP/1.1 303 See Other':@CRLF:'Location: ':_url,2)
#endfunction