javascript before redirect |
[eluser]syntaxerror[/eluser]
hi, can anyone please tell me how to execute javascript first before redirect? i have a script here but it skips javascript and executes javascript. Code: [removed] i want to check if a file exist, if that file doesnt exist, it pops up an alert box and return to the input text page. the problem is it skips the alert message and just redirect the page. please advice. thanks
[eluser]Nick Husher[/eluser]
I don't know for sure, but I think that CI uses a header redirect rather than an HTML redirect when you use the redirect function. You should think about doing the redirection in javascript- Code: <html>
[eluser]syntaxerror[/eluser]
thanks! but the javascript isnt working. it didnt redirect in 5 seconds.
[eluser]syntaxerror[/eluser]
i made it working. i made a new page, redirect to that page if a file doesnt exist. and in that page i have a javascript. Code: <html>
[eluser]Nick Husher[/eluser]
Yeah, I mistyped. Replace document.location with [removed], and it should work. Note that the redirect requries javascript to be enabled to work, which is less than ideal. That's why I added the hard HTML link. Also, you can avoid javascript alltogether if you use a meta-tag redirect: http://webmaster.indiana.edu/tool_guide_...atag.shtml |
Welcome Guest, Not a member yet? Register Sign In |