How to redirect a page based on browser used - user-agent

I have a page on my site that doesn't display well when viewed from Mozilla Firefox. I have some jQuery codes that don't work on Mozilla. It displays well on Some other browsers.
I am wondering if there is a way I can redirect my visitors who use Mozilla to an alternate URL where I will remove the jQuery code.
Pls any help?
Thanks.

Related

jQuery Mobile - next page still has previous page meshed on top of new pages content

Right, I don't really know how to explain this one but I will do my best by giving a scenario:
Homepage -> Contact page
Home page elements and text displays on top of the contact pages text.
Anyone know why this would be happening? Or if there has been any issues like this from the past?
Help and suggestions will be much appreciated
Edit: There is also nested menus and it is always the homepage that displays on top of content. The url seems to change first to the secondary page url, then it suddenly changes to the homepage url. It also blinks but I think this is an issue that jQuery mobile havent fixed using jQuery mobile 1.2.0

Embed iframe cross domain

I need to have an iframe script which I can give to my different clients, so that they can embed it in their sites. Just like Youtube or facebook does.
But it does not get rendered due to cross domain restrictions.
I have gone through every documentation for x - frame options , crossDomain ajax call.
The problem with crossDomain ajax call is that I have only JSONP to work with.
I have tried this - just go to any youtube video and get its Embed code. Its a plain iframe script e.g. <iframe width="420" height="315" src="http://www.youtube.com/embed/7N5OhNplEd4" frameborder="0" allowfullscreen></iframe>
If you inject the above script in your html, it will get rendered , but as soon as you edit the src of the iframe to youtube.com itself , it will go blank.
Facebook's iframe too gets rendered everywhere smoothly.
I am hell tortured by this thing.
Please guide me on this. Thanks in advance!
IF you look at the response headers from youtube.com it is returning "X-Frame-Options:SAMEORIGIN" so they are adding the header on the server to stop people from displaying youtube (website pages) via a iframe.

There can be AJAX behavior even when the URL changes in browser?

If using the current Chrome, Firefox, and Safari, when switching between
http://www.facebook.com/my_name
http://www.facebook.com
The side panel for feed and chat, and any chat box actually stays. I thought when the URL changes, the page has to refresh as a whole, but obviously, this is not the case here. How is that done?
On IE 9, the URL actually became http://www.facebook.com/#! and using the "hash" to do ajax without refreshing the page, which is more understandable.
You can change the URL and page history from javascript without actually reloading the page.
See this answer on another question.
Note, that if you type the new URL by yourself and press enter the whole page reloads.
this might be the internal linking in the webpage with hidden DIVs with IDs and onClick those Hidden DIVs get visible with javascript and with AJAX content is loaded it will be a good if you browse the site disabling javascipt

How does a website load only part of the page and still display full on URLs?

I am looking at the Gawker blogs (http://io9.com, http://lifehacker.com/) and I'm curious about how they are made.
When I click for on a link only the article part of the page reloads displaying a loading icon while it does.
But what I can't figure out is that links point to new URLs like io9.com/something/something and its not something like I see on ajax pages that they put a site.com/#something tag at the end of the url from javascript to mark the page after an ajax request.
Can I change the full blown URL from javascript or what is happening?
When it happens, the website is using the HTML5 History API. This API can change the url (via JavaScript) without changing the page.
See caniuse.com for browser support.
If you would like to implement it in yout website, backbonejs.org would be very useful.

Loading Ajax Response Data with Adsense Codes inside

I'm 10000000% sure that this question has been asked before, however, the majority of the responses that I came across were from back in 2005, 2006 and so on. Not to mention, almost all of the questions themselves were too general. Therefore, I'm asking this so that for anyone else needs to find this out, then they won't need to dig through about 50 webpages to get an idea.
My question is simply that I have a webpage that has Google Ads embedded into the HTML of the website. The website was first developed as a static HTML site where each link reloaded a new page. Nevermind the backend technology of the website - the website itself produces purely dynamic content. The website is close to completion and now a fully-ajax listener has been added to all the links. When any of the links are clicked, JavaScript takes over, parses the link and sets that using popstate or the hashbang. The page itself is then queried to the server via AJAX and the content is updated using document.getElementByID('container').innerHTML=ajax.responseText; This way, there is almost a 100% method of accessing content that was replaced by AJAX.
This all works fine, but the responseText itself may, WILL contain Google Ads, and I was just wondering how to display them as if it were a static page. Clearly this doesn't work. Here are the options that I've come across:
Use an IFrame:
An IFrame seems to be an effective way to load the content; just stick the adsense codes a simple adsense.html iframe file and let the browser and
directly into page, it isn't possible
it's against their TOS
there is document.write() omitted in ajax request
Your chance is:
Create simple iframe
<iframe src="advert.html"></iframe>
and in advert.html, add your advert code
It's then loaded fine without problems.
Good luck

Resources