Quantcast

$this->Html->link with javascript back()

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

$this->Html->link with javascript back()

martin
can't find out how to resolve:

<a href="javascript:history.back()">go back</a>

with:

$this->Html->link




--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: $this->Html->link with javascript back()

iammikek
> can't find out how to resolve:
>
> <a href="javascript:history.back()">go back</a>
>
> with:
>
> $this->Html->link


you can do

                echo $this->Html->link('go back',"javascript:history.back()");


i think its much better to add

        $this->set('referer',$this->referer());

to your beforeRender();

and

$this->Html->link('back',$referer);

to  your view.

one less reliance on js is a win in my book.




Mike Karthauser
Managing Director - Brightstorm Ltd

Email: [hidden email]
Web: http://www.brightstorm.co.uk
Tel:  07939 252144 (mobile)
Fax: 0870 1320560

Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: $this->Html->link with javascript back()

Miles J
Or you can just do:

<a href="javascript:history.back()">go back</a>

No need to use an HTML helper for a task its not needed for.

On Feb 25, 4:48 am, [hidden email] wrote:

> > can't find out how to resolve:
>
> > <a href="javascript:history.back()">go back</a>
>
> > with:
>
> > $this->Html->link
>
> you can do
>
>                 echo $this->Html->link('go back',"javascript:history.back()");
>
> i think its much better to add
>
>         $this->set('referer',$this->referer());
>
> to your beforeRender();
>
> and
>
> $this->Html->link('back',$referer);
>
> to  your view.
>
> one less reliance on js is a win in my book.
>
> Mike Karthauser
> Managing Director - Brightstorm Ltd
>
> Email: [hidden email]
> Web:http://www.brightstorm.co.uk
> Tel:  07939 252144 (mobile)
> Fax: 0870 1320560
>
> Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: $this->Html->link with javascript back()

matze
In reply to this post by iammikek
Am Freitag, 25. Februar 2011 13:48:22 UTC+1 schrieb (unbekannt):


i think its much better to add

        $this->set('referer',$this->referer());

to your beforeRender();

and

$this->Html->link('back',$referer);

to  your view.

one less reliance on js is a win in my book.


Mike Karthauser


or your solution as fallback combined with js:

$this->Html->link('back', $referer, array('onclick' => 'history.back(); return false;'));

this way the browser-history-cache will be used if js is available... 

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 
Loading...