how to prevent changed url in the browser bar from reflecting in the website content? - yii

how to prevent the change in the url of the browser bar from reflecting in the website content's URLS...
here is the situation,
in my current web app, I am using this
$this->createUrl(Yii::app()->controller->id ."/". Yii::app()->controller->action->id, $params)
to generate href of the hyperlinks... now the problem is,
when I type in the browser bar like e.g
www.mysite.com/blahblahblah/subcategory/c1
the blahblahblah, also reflects to the webpage content hyperlinks,because of the Yii::app()->controller->id that I passed to the createUrl function...any work around for this ?..., what i want to happen is, no matter what string is typed in the place of the controller name via the browser bar, it won't reflect in the webpage content hyperlinks ..
so how ?

the answer was, I took the ID from the URL ,created a simple Helper function and used that to return the correct value of category/subcategory and outputs it in the view source no matter what change is done via the browser bar

Related

CRM 2013 WebResource IFrame

I have an HTML web resource in an opportunity that produces a css tab control containing all children opportunity to the current record.
I do this through Ajax and javascript and everything works fine, a new tab is made for each child and it shows an opportunity record inside; the only issue is that it will only show the current record inside of this tab - effectively creating an endless loop.
If I paste the URL from the IFrame into the browser it shows the proper record using the right form that I specify(one that doesn't contain another web resource).
Does anyone know why it wouldn't show the same form as it navigates to? If I try google.com it works, just not for this URL:
http://server/CRM/main.aspx?etn=opportunity&pagetype=entityrecord&navbar=off&id=%7B"+val.OpportunityId+"%7D&extraqs=formid%3DC1EC704C-D29B-4786-806F-195D0A80CF07%0D%0A#255409204
Try constructing the URL with this format:
http://server/CRM/main.aspx?etc=3&extraqs=formid%3dC1EC704C-D29B-4786-806F-195Dā€Œā€‹0A80CF07%7d&id=%7b<EnterOppIdHere>%7d&pagetype=entityrecord
Use the Entity Type Code (etc parameter) instead of the Name (etn) and note that everything after that should be part of the extraqs parameter.

fixed url on address bar - show only base url http://www.mysite.com

I need to show on the address bar just the first part of the url of my site.
For example for any page with name like
http://www.mysite.com/mypage.php or
everything else
I want to see just http://www.mysite.com on the address bar of the browser.
How this can be achieved?
I tried with apache RewriteRule but with no result.
Apart from being a really bad idea for people actually trying to use your site, there is no way you can do this on the server side, because the server needs to know which page was accessed - that's what a URL is for. What you are looking for is to make it appear to the user that they are still at the same URL.
This is easy enough if you put your entire site in an HTML frameset with one frame, or an iframe sized to fill the browser window. This does require all external links to have target="_top", and without additional JS people can break out of the frame and access the pages individually anyway.
An alternative approach, that will only work on some browsers, would be to use history.pushState to fake the address bar back to / every time a new page loads.

change the anchor (location.hash) in the address-bar

I have an FB application that uses the anchor (document.location.hash) to set tags on different elements (for example the current TAB#, the group# that is displayed...).
So whenever the user changes these elemets, I change the anchor (location.hash) and it adds #tag=...
to the URL in the address-bar (and when the user copy the link and sends it to another user) he is redirected to the specific view (on the same page).
It works well when the app is a standalone site.
But when I put it under FB application (apps.facebook.com/myapp) - it does not change the URL in the address-bar (but when I read the document.location.has I see the change). I think maybe it is because my app is inside an IFRAME.
If it cannot be fixed, maybe there is a Facebook API that changes the hash part in the URL!!!
This is not possible to change the parts of location object of parent frame if it's served from different domain... You can only change the whole location by setting it to new value:
window.top.location = 'http://example.com';
Actually document.location always refers to current document, while window.location refers to top level document and represent the URL that user see in address bar of the browser.
So generally you changed the hash for current document and if it's opened as standalone site user sees that in address bar, but once running in frame (application canvas) user doesn't see the URL of that page, but parent frame which located on other domain and subject of cross-domain policy.

updating browser address field correctly on `pushstate`

I am loading data in the web page via ajax, and using pushstate and popstate trickery to change the browser address field. The problem is that my ajax URLs are like so
2011/07/25/foo.txt
2011/07/26/bar.txt
2011/07/27/baz.txt
So, the first time the web page loads, the browser address field is http://webserver/. On the first ajax load, it becomes http://webserver/2011/07/25/foo.txt. On the second ajax load it becomes http://webserver/2011/07/25/2011/07/26/bar.txt. On the third ajax load the browser URL field becomes http://webserver/2011/07/25/2011/07/26/2011/07/27/baz.txt. In other words, only the last fragment of the address field (split on '/') gets replaced.
How can I replace the entire address field?
Add a leading / to the pushed path.

open webpage (or snapshot of webpage) into another webpage though vb.net

i have an aspx page with vb.net back end. in that page i get names and url's from the database depending on different conditions. My requirement is that when i get the url, the code should then use that url and have that webpage in a small preview form on my existing aspx page.
so basically i have a table as follows -
Name URL Preview-URL
Sandy www.myspace.com/sandy -- should be the url webpage in specified height and width.
Mandy www.myspace.com/mandy -- should be the url webpage in specified height and width.
does anyone know how i can achieve this?
You can create small url previews by using the iFrame tag. Let's say you have an asp:PlaceHolder control called "iframePlaceholder" in your aspx. In your code behind you could do something like:
Dim iframeControl As New LiteralControl("<iframe src=""www.myspace.com/mandy"" width=""100px"" height=""300px"">")
iframePlaceholder.Controls.Add(iframeControl)