Help Center Manage Your Account Technical
How do I detect device orientation for iPhone/iPad?
In this example, you have two interstitial ad versions. One is a vertical ad for portrait mode and one is a wide ad for landscape mode. Other types of ad format can be done similarly. You want to display the correct ad depending on how the device is handled.<script type="text/javascript"> function detectOrientation() { var chosenAd; var adHorizontal = 'http://g.adspeed.net/ad.php?do=inter&aid=123&wd=-1&ht=-1&int=5&cls=20&wai=0'; var adVertical = 'http://g.adspeed.net/ad.php?do=inter&aid=456&wd=-1&ht=-1&int=5&cls=20&wai=0'; if (typeof window.onorientationchange != 'undefined') { if (window.orientation==0) { // portrait chosenAd = adVertical; } else if (window.orientation==90 || window.orientation==-90) { // landscape chosenAd = adHorizontal; } // fi document.write('<scr'+'ipt type="text/javascript" src="'+chosenAd+'"></scr'+'ipt>'); } // fi } detectOrientation(); window.onorientationchange = detectOrientation; </script>
Other Articles in Technical
Solve technical issues while working within the ad server
- Do ad clicks have referrer information from my site?
- How do I clear the browser cache and cookie?
- How do I optimize my website for faster loading time?
- How do I perform A/B split testing for ad variations?
- How do I record page views and unique visitors?
- How do I remove spyware and malware from my computer?
- How do I setup a video ad with multiple bitrates?
- How to convert a date string to a unix timestamp and vice versa?
- Why do some icons/images look different in Internet Explorer?
Cannot find an answer for your question? Ask our Customer Care team
Related
- Ad Blocker Detection
"Ad blockers, like AdBlock or AdBlockPlus, are a problem with publishers that depend on advertising. They work with a block ..."
in Ad Tools - Click to a new or same window
"The HTML target attribute determines whether to open a link in a blank new window, the current window, or a ..."
- What is "Object Expected" error in Internet Explorer?
"If an ad shows up properly in Firefox, Safari, Opera but it shows an error "Object Expected" in Internet Explorer, ..."
- What is the pop-up and pop-under ad tag?
"Pop-up ad displays as a new window in front of the current page so visitors will see it immediately. Pop-under ..."
- How can I defer ads until after the page has finished loading?
"Typically, content is loaded according to the components' order in the HTML source code. If you want visitors to see ..."