Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum https://www.tinywebgallery.com/forum/ |
|
Redirect frame pages to main page with the frame embedded https://www.tinywebgallery.com/forum/viewtopic.php?f=21&t=4303 |
Page 2 of 2 |
Author: | TinyWebGallery [ 20. Apr 2017, 22:41 ] |
Post subject: | Re: Redirect frame pages to main page with the frame embedde |
Because the difference is only the page parameter? then you need to do some custom coding that the page itself is added encoded to the redirect url. Best, Michael |
Author: | TinyWebGallery [ 20. Apr 2017, 22:55 ] |
Post subject: | Re: Redirect frame pages to main page with the frame embedde |
You can use the following: var iframe_redirect_url = "http://www.hafdal.dk/legstadaleit/gagnagrunnur/?lang=is&page=" + escape(window.location.href); if http://www.hafdal.dk/tng/getperson.php?personID=I4042&tree=Tree2 Should be redirected to this page: http://www.hafdal.dk/legstadaleit/database/?lang=is&page=www.hafdal.dk%2Ftng%2Fgetperson.php%3FpersonID%3DI4042%26tree%3DTree2 Best, Michael |
Author: | xega [ 20. Apr 2017, 23:09 ] |
Post subject: | Re: Redirect frame pages to main page with the frame embedde |
Sorry I am not making myself clear. I have thousands of pages in www.hafdal.dk/tng, like for example http://www.hafdal.dk/tng/getperson.php?personID=I4042&tree=Tree2 or www.hafdal.dk/tng/statistics.php or http://www.hafdal.dk/tng/showmedia.php?mediaID=3802 or www.hafdal.dk/tng/cemeteries.php or http://www.hafdal.dk/tng/showmap.php?cemeteryID=72&tree=Tree2 ALL these pages have footer.php in common. Normally, people view these pages in an advancd iframe in my WP page http://www.hafdal.dk/legstadaleit BUT Google finds these pages and links to them directly, and they are displayed without being inside my main site (http://www.hafdal.dk/legstadaleit). I understand now, I cannot make the page redirect in an iframe in the main site, but what I want is, if people get a link to my "iframe pages" (in red color above), they get redirected to http://www.hafdal.dk/legstadaleit Is that still possible? |
Author: | TinyWebGallery [ 20. Apr 2017, 23:18 ] |
Post subject: | Re: Redirect frame pages to main page with the frame embedde |
does my last post not help you? Is the parent domain completely different for all you pages? You can define one url really easy. I think this is what you have running. If you can define a pattern how the url is created you can do this with Javascript also before the ai_external.js. Best, Michael |
Author: | xega [ 20. Apr 2017, 23:47 ] |
Post subject: | Re: Redirect frame pages to main page with the frame embedde |
Hello again Michael Sorry! I didn not see your second post! I have now corrected the script in footer.php to be: Code: <script> var iframe_redirect_url = "http://www.hafdal.dk/legstadaleit/gagnagrunnur/?lang=is&page=" + escape(window.location.href); </script> <script src="http://www.hafdal.dk/legstadaleit/wp-content/plugins/advanced-iframe/js/ai_external.js"></script> The redirect works (YAY!!!!!!!!!) BUT it does not redirect correcly. So going to http://www.hafdal.dk/tng/getperson.php?personID=I4042&tree=Tree2 gives me this URL: http://www.hafdal.dk/legstadaleit/gagnagrunnur/?lang=is&page=www.hafdal.dk%2Ftng%2Fthispagedoesnotexist.html&tree=Tree2 and not http://www.hafdal.dk/legstadaleit/database/?lang=is&page=www.hafdal.dk%2Ftng%2Fgetperson.php%3FpersonID%3DI4042%26tree%3DTree2 Thank you for being so patient! I have an illness that affects my brain (memory and concentration) so I am a bit slow sometimes Your support is excellent!! |
Author: | xega [ 21. Apr 2017, 06:24 ] |
Post subject: | Re: Redirect frame pages to main page with the frame embedde |
I have tested this a litte further and noticed that some links do redirect correctly. Does not work: http://www.hafdal.dk/tng/getperson.php?personID=I4042&tree=Tree2 Does not work: http://www.hafdal.dk/tng/showmedia.php?mediaID=3802 Works OK: http://www.hafdal.dk/tng/statistics.php Works OK: http://www.hafdal.dk/tng/cemeteries.php Works OK: http://www.hafdal.dk/tng/showmap.php?cemeteryID=72&tree=Tree2 Any idea why some pages work and others do not work? |
Author: | TinyWebGallery [ 21. Apr 2017, 09:19 ] |
Post subject: | Re: Redirect frame pages to main page with the frame embedde |
Why is gagnagrunnur var iframe_redirect_url = "http://www.hafdal.dk/legstadaleit/gagnagrunnur/?lang=is&page=" + escape(window.location.href); and not var iframe_redirect_url = "http://www.hafdal.dk/legstadaleit/database/?lang=is&page=" + escape(window.location.href); set? stange is that window.location.href gives a pagedoesnotexist.html . can you add console.log('current url: ' window.location.href); before the var iframe_redirect_url To get some debug information? Best, Michael |
Author: | xega [ 21. Apr 2017, 13:59 ] |
Post subject: | Re: Redirect frame pages to main page with the frame embedde |
var iframe_redirect_url = "http://www.hafdal.dk/legstadaleit/gagnagrunnur/?lang=is&page=" + escape(window.location.href); and var iframe_redirect_url = "http://www.hafdal.dk/legstadaleit/database/?lang=is&page=" + escape(window.location.href); work in the same way, I think it's because I use WPML plugin. I added console.log('current url: ' window.location.href); to the script so it now looks like this: Code: <script>
console.log('current url: ' window.location.href); var iframe_redirect_url = "http://www.hafdal.dk/legstadaleit/database/?lang=is&page=" + escape(window.location.href); </script> <script src="http://www.hafdal.dk/legstadaleit/wp-content/plugins/advanced-iframe/js/ai_external.js"></script> |
Author: | TinyWebGallery [ 21. Apr 2017, 14:24 ] |
Post subject: | Re: Redirect frame pages to main page with the frame embedde |
Sorry. a + is missing: console.log('current url: ' + window.location.href); Best, Michael |
Author: | xega [ 21. Apr 2017, 14:28 ] |
Post subject: | Re: Redirect frame pages to main page with the frame embedde |
Fixed it! |
Author: | TinyWebGallery [ 21. Apr 2017, 21:54 ] |
Post subject: | Re: Redirect frame pages to main page with the frame embedde |
I know the problem. iframe_redirect_url does automatically add the parameters to the redirect url because then it is possible to pass them through the parent again. But In your case this does break the functionality. I have fixed this in my code but you can try var iframe_redirect_url = "http://www.hafdal.dk/legstadaleit/gagnagrunnur/?lang=is&page=" + escape(window.location.href) + "&"; this will cause that the invalid part I add for you is not used. Please give it a try. If this does not work I can provide you with the fixed code. Best, Michael |
Author: | xega [ 21. Apr 2017, 22:01 ] |
Post subject: | Re: Redirect frame pages to main page with the frame embedde |
That works perfectly! THANK YOU!!! Should I keep this in my script? Code: console.log('current url: ' + window.location.href);
|
Author: | TinyWebGallery [ 21. Apr 2017, 22:25 ] |
Post subject: | Re: Redirect frame pages to main page with the frame embedde |
No - this was only for debugging. I will also include into my script that this works even without the & Best, Michael |
Author: | xega [ 21. Apr 2017, 22:27 ] |
Post subject: | Re: Redirect frame pages to main page with the frame embedde |
Ok thank you! When the next update comes, will I have to change anything? |
Author: | TinyWebGallery [ 21. Apr 2017, 22:30 ] |
Post subject: | Re: Redirect frame pages to main page with the frame embedde |
No - I simply check internally if a ? is already in the url and don't include the extra parameters then. Best, Michael |
Page 2 of 2 | All times are UTC + 1 hour [ DST ] |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |