You are not logged in.

Announcement

Forum database was corrupt and an old backup was restored as temporary replacement. Registrations closed until the database is recovered. Please ask questions using the Contact form

#1 11-07-2014 19:48:05

rsalomone
Contributors
Registered: 22-11-2013
Posts: 101
Website

document.referrer does not contain the ?url= portion

Is there a way to retrieve the previous (referring page) url?

Right now, I get the referring page as index.php smile rather than say, index.php#!/url=contact.php.

rs

Last edited by rsalomone (11-07-2014 19:49:01)

Offline

#2 13-07-2014 00:12:43

Thomas
Administrator
Registered: 10-03-2013
Posts: 897

Re: document.referrer does not contain the ?url= portion

That's because of the ajax workings of the template. The only way would be using javascript (document.referrer), or use the "static pages" plugin for this template.

Offline

#3 14-07-2014 19:56:32

rsalomone
Contributors
Registered: 22-11-2013
Posts: 101
Website

Re: document.referrer does not contain the ?url= portion

Unfortunately,  document.referrer does not return the extended parameters either.

I am looking to find the parameter.

rs

Offline

#4 03-08-2014 07:54:04

chrismaliszewski
Contributors
From: Torun, Poland
Registered: 06-05-2013
Posts: 246
Website

Re: document.referrer does not contain the ?url= portion

Link to one solution to a problem of yours. Haven't tried it.

Another solution (much easier) would be using cookies or other type of client data storage (because people don't like cookies, maybe webstorage would be better) to store previous full link in it, i.e.:

$.cookie("previousUrl", window.location.href, {path:"/"});

Offline

#5 03-08-2014 18:15:22

Thomas
Administrator
Registered: 10-03-2013
Posts: 897

Re: document.referrer does not contain the ?url= portion

maybe it's easier if you can specify more exactly what you want to do with it. Because maybe setting a variable in javascript is already enough. wink

Offline

#6 05-08-2014 14:48:23

rsalomone
Contributors
Registered: 22-11-2013
Posts: 101
Website

Re: document.referrer does not contain the ?url= portion

Gentlemen

Thank you for your response.

I was hoping to get the previous url for use with a feedback form which is linked to many pages.   I would like to collect the previous URL and store it in a hidden variable.  Therefore, if the feedback.php form was called from the contact.php page, I would store "contact" in the hidden field.   If the feedback.php form was called from some product.php page, I would store the "product" in the hidden field.  This would be passed to a database for statistical use.

Secondly,  I would like to know where the "document.title" is set.   I see that the page name is part of the document title.  I plan to replace the "page name" with an actual title using javascript.   Therefore,   index.php/#!/contact.php currently produces the document.title  "contact | Main Site Title Here".    I have an xml file which stores a more descriptive title.   I store the tag "contact" and the more descriptive title.  Then using javascript, I load the more descriptive tag.   I get "Contact Us Feedback Form |  Main Site Title Here".    I have this all working now but I parse the document.title to get the page name.  Is there a better way?

Offline

#7 05-08-2014 23:23:00

Thomas
Administrator
Registered: 10-03-2013
Posts: 897

Re: document.referrer does not contain the ?url= portion

The title is set in main.js for the javascript part (just search for document.title) and in seo.php for the php part (needed for search engines etc)

I don't recommend doing crazy things in the files. You can easily set the "contact" to whatever you want in config/pages.php

The array $pageTitles stores exactly what you want to change wink


If you use a link to your feedback form, you could just add the current page as argument to the url?
#!/contact&s=the_current_page

Or you can set a variable in javascript storing the previous url. This can be done without changes to the source files (just add <script>page.previous = 'whateveryouwant'</script>) or with changes to the source files to do it automatically. (but I'll add that tomorrow, if you would need it)

You can then just get the previous file:
<script>
if(typeof page.previous != "undefined"){
    //previous page is in page.previous
}
</script>


Not 100% or something like that but since it's just for statistic things, it should be enough.

Offline

#8 08-08-2014 15:09:55

rsalomone
Contributors
Registered: 22-11-2013
Posts: 101
Website

Re: document.referrer does not contain the ?url= portion

Thomas wrote:

"The title is set in main.js for the javascript part (just search for document.title) and in seo.php for the php part (needed for search engines etc)

I don't recommend doing crazy things in the files. You can easily set the "contact" to whatever you want in config/pages.php

The array $pageTitles stores exactly what you want to change!"


Thomas,   I did assign all my pages in pages.php and filled in $pageTitles, $pageDescription, $pageKeywords for all of them.   However, the document.title does not get updated with the $pageTitles long description unless I physically set it in every page  document.title = $pageTitles['whatever page'];   The only way it gets set is when I refer tho the page using _escapefragment.

I would like to set document.title to $pageTitles[] every time.   it should work given your explanation.

Last edited by rsalomone (08-08-2014 15:11:12)

Offline

Board footer

Powered by FluxBB