Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JS Confirm blocking referrer 1

Status
Not open for further replies.

cian

Technical User
Oct 11, 2001
1,383
Hi guys,

I'm working a php bookmark type script. I have a confirm alert on each link delete button, when confirmed the link gets deleted. Problem is the script processing the deletion needs to read the referrer to refer back to that page after the link is deleted.

Problem: It won't work in IE. It can't seem to check the referrer so returns an error. But it will work in Moz, NS & Opera.
The JS i'm using is below. Do you think it can be changed to also work in IE or should I forget about it? I really do need a confirm on the delete button and the delete script cannot point directly to a named file but must check for a referrer. Any ideas?

Code:
<a href=&quot;javascript:if (confirm('Delete link?')) {location.href='process.php?action=delete&id=123';}&quot;>Delete</a>

Any help greatly appreciated!!





<!--#sig value=''É'' url='' -->
 
>> Problem is the script processing the deletion needs to read the referrer to refer back to that page after the link is deleted.

is this a javascript or PHP problem???


Known is handfull, Unknown is worldfull
 
I assumed it was a javascript problem otherwise the browser version would have no effect?
It's only IE that it won't work in, other browsers I have tested work fine.

If it was a PHP problem then it wouldn't work in any browser.







<!--#sig value=''É'' url='' -->
 
i had that doubt becase:
>>script processing the deletion needs to read the referrer

the script to delete will be a PHP, and whta does this referrer mean? u want to go to the previous page after deleting the link???

Known is handfull, Unknown is worldfull
 
Yep, to break it down.

On (for example) bookmarks.htm you click &quot;delete link&quot; and confirm, it goes to process.php which is the script that deletes the link from the database. Process.php also reads the referrer and then redirects back to that page.
My guess is that somehow the confirm js is confusing IE.

Or am I way off the mark here??




<!--#sig value=''É'' url='' -->
 
the refferer here is bookmarks.htm right????

Known is handfull, Unknown is worldfull
 
In this case yes but I am using a generic delete script which must delete from any number of pages, otherwise it would be very easy :)

I don't have the script with me but I am referring with basically (syntax may not be correct cos it's off the top of my head but it works(except IE)):

Code:
header('Location: ' . $HTTP_SERVER_VARS[&quot;REFERER&quot;]');





<!--#sig value=''É'' url='' -->
 
if that is breaking ur head, use javascript:
<?
//ALL php code
?>
<script>
locatio.href=history.back()
</script>


Known is handfull, Unknown is worldfull
 
Btw, this WILL work in IE if I remove the javascript confirm function, sorry I should also have mentioned that at the start.




<!--#sig value=''É'' url='' -->
 
Thanks, i'll try that tonight. Question is, will it reload the page, the page must be displayed with the relevant link removed.




<!--#sig value=''É'' url='' -->
 
yes it will refresh the page...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top