function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JonReevesJonReeves 

Direct URL for VF Pages

So I have a VF page which renders as JSON, but I can't do any AJAX requests to it, because everytime I fetch the address:

https://c.na1.visual.force.com/apex/pageName

it gets rewritten as:

https://na1.salesforce.com/visualforce/session?url=https://c.na1.visual.force.com/apex/pageName

 

The redirect kills any AJAX methods I try.

 

Any suggestions? I'm curious if there is another way I can reach the VF page.. a static link or something.

JonReevesJonReeves

unfortunately not... I'm working in the Customer Portal to supplement the Advanced Search page using Ajax. Basically the Advanced search isn't truely global and dosen't search Knowledge or Content. Because the Advanced Search page is not accessible via VF, all I can do is add JS to the header.html that gets included on everypage.

 

The itent was to write some JS that would only function on the advanced search page. It would obtain the passed var 'str' and via AJAX request send it a VF page I wrote that returns JSON results for that search term. If those results were not empty it would inject them onto the page it is own section.

 

I wrote the VF to JSON page, I wrote the AJAX calls, and build the JS output method, but then noticed in Chrome that when requesting the VF page via XHR it gets cancelled due to some redirecting.

 

I think I'm pretty much out of luck, trying to do it this way, I just wanted to check  if there was another way to directly reference a VF page's URL.. ie... can:
https://c.na1.visual.force.com/apex/pageName be viewed like https://na1.salesforce.com/0000aaaehegsgsh

aballardaballard

You should be able to use the urlfor() function to get the correct absolute url for a vf page... e.g. {!urlfor('/apex/page')}

JonReevesJonReeves

didn't know that one. tried it but gives me the address I'm already using. Guess I'm outta luck on this one.

 

thanks anyways.