Dean
Dean

Reputation: 21

perl: return no content back to browser

I'm passing a url (from javascript) to a perl script. The perl script gets data back from the URL, processes it and writes a file. That's all working fine.

At this point all I want to return processing to the browser/javascript but I'm struggling to prevent the perl script from returning content to the browser. It just blanks the page.

I suspect it's the content type/header that's causing the issue but can't seem to find a way to inhibit it returning something the browser wants to display.

So far after much hunting I came across

print "Status: 204 No Content\n\n";

Looked promising but I suspect just having the print command is enough to push something back at the browser.

Any pointers appreciated. I can't be the only person that just wants perl to go off and do a job without returning content.

Upvotes: 2

Views: 125

Answers (1)

Quentin
Quentin

Reputation: 944054

There has to be a response to the request, and the 204 No Content will push something back to the browser: the information that there is no content to display (so browsers will continue to display the previous content).

Upvotes: 1

Related Questions